浏览代码

cleaned up and updated comments and editor class name

/4.1
Shan Jiang 4 年前
当前提交
0a26b10f
共有 3 个文件被更改,包括 15 次插入21 次删除
  1. 27
      Assets/Scenes/ImageTracking/ImageTrackingWithMultiplePrefabs/PrefabImagePairManager.cs
  2. 1
      Assets/Scenes/ImageTracking/Prefabs/FlowerPrefab/Shaders/Vegetation.shader
  3. 8
      Assets/StreamingAssets.meta

27
Assets/Scenes/ImageTracking/ImageTrackingWithMultiplePrefabs/PrefabImagePairManager.cs


{
/// <summary>
/// This component listens for images detected by the <c>XRImageTrackingSubsystem</c>
/// and overlays some information as well as the source Texture2D on top of the
/// detected image.
/// and overlays some prefabs on top of the detected image.
/// </summary>
[RequireComponent(typeof(ARTrackedImageManager))]
public class PrefabImagePairManager : MonoBehaviour, ISerializationCallbackReceiver

}
#if UNITY_EDITOR
/// <summary>
/// This customizes the inspector component and updates the prefab list when
/// the reference image library is changed.
/// </summary>
class MultiTrackedImageInfoManagerInspector : Editor
class PrefabImagePairManagerInspector : Editor
{
List<XRReferenceImage> m_ReferenceImages = new List<XRReferenceImage>();
bool m_IsExpanded = true;

return false;
}
public override void OnInspectorGUI ()
public override void OnInspectorGUI()
{
//customized inspector
var behaviour = serializedObject.targetObject as PrefabImagePairManager;

{
EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Script"));
}
var libraryProperty = serializedObject.FindProperty(nameof(m_ImageLibrary));
EditorGUILayout.PropertyField(libraryProperty);
var library = libraryProperty.objectReferenceValue as XRReferenceImageLibrary;

}
behaviour.m_PrefabsDictionary = tempDictionary;
}
}
}
// update current
m_ReferenceImages.Clear();

using (new EditorGUI.IndentLevelScope())
{
EditorGUI.BeginChangeCheck();
var prefab = (GameObject)EditorGUILayout.ObjectField(image.name, behaviour.m_PrefabsDictionary[image.guid], typeof(GameObject), false);
var prefab = (GameObject) EditorGUILayout.ObjectField(image.name, behaviour.m_PrefabsDictionary[image.guid], typeof(GameObject), false);
if (EditorGUI.EndChangeCheck())
{
Undo.RecordObject(target, "Update Prefab");

}
}
}
}
}
#endif
}

1
Assets/Scenes/ImageTracking/Prefabs/FlowerPrefab/Shaders/Vegetation.shader


// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)

8
Assets/StreamingAssets.meta


fileFormatVersion: 2
guid: 0c74313019bf466f93215837bfcef0dd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存