浏览代码

solved some bugd and pulled from latest preview

/4.1
Shan Jiang 5 年前
当前提交
f9f5e6d8
共有 3 个文件被更改,包括 33 次插入28 次删除
  1. 9
      Assets/Scenes/ImageTracking/Multi Prefab - Image Tracking/Multi-Image Tracking.unity
  2. 48
      Assets/Scenes/ImageTracking/Multi Prefab - Image Tracking/MultiTrackedImageInfoManager.cs
  3. 4
      ProjectSettings/ProjectSettings.asset

9
Assets/Scenes/ImageTracking/Multi Prefab - Image Tracking/Multi-Image Tracking.unity


m_Name:
m_EditorClassIdentifier:
m_PrefabList:
- m_Prefab: {fileID: 6916502901855112170, guid: e22b43a8fcdab413bb4f52f5076f759e,
- m_ImageGuid: f0340be5-710e-49ff-bc70-45f1315b9202
m_Prefab: {fileID: 6916502901855112170, guid: e22b43a8fcdab413bb4f52f5076f759e,
- m_Prefab: {fileID: 2804028924010200506, guid: 379785de5e39005469c875710d3cc5a7,
- m_ImageGuid: 2c29eeed-d95c-4111-b724-80f9ff10ce86
m_Prefab: {fileID: 2804028924010200506, guid: 379785de5e39005469c875710d3cc5a7,
- m_Prefab: {fileID: 3279860958548870494, guid: 2584331523bd14e8898965d93034efdb,
- m_ImageGuid: aae75228-1973-4dc0-b7a2-53d1566ee402
m_Prefab: {fileID: 3279860958548870494, guid: 2584331523bd14e8898965d93034efdb,
type: 3}
m_ImageLibrary: {fileID: 11400000, guid: c86e375d7e7430442a1104e88fa21f21, type: 2}
--- !u!114 &264295717

48
Assets/Scenes/ImageTracking/Multi Prefab - Image Tracking/MultiTrackedImageInfoManager.cs


/// </summary>
public struct NamedPrefab
{
Guid m_ImageGuid;
[SerializeField]
string m_ImageGuid;
public Guid imageGuid
public string imageGuid
get => m_ImageGuid;
get => m_ImageGuid;
}
[SerializeField]

{
get => m_Prefab;
get => m_Prefab;
public NamedPrefab(Guid imageGuid, GameObject prefab)
public NamedPrefab(Guid guid, GameObject prefab)
m_ImageGuid = imageGuid;
m_ImageGuid = guid.ToString();
m_Prefab = prefab;
}
}

Dictionary<Guid, GameObject> m_PrefabsDictionary = new Dictionary<Guid, GameObject>();
ARTrackedImageManager m_TrackedImageManager;
[SerializeField]
[Tooltip("Reference Image Library")]
XRReferenceImageLibrary m_ImageLibrary;

void Awake()
{
m_TrackedImageManager = GetComponent<ARTrackedImageManager>();
{
{
m_PrefabsDictionary.Add(ImageLibrary[i].guid, prefabList[i].prefab);
}
}

{
if (library)
{
if (m_PrefabList == null)
if (prefabList == null)
m_PrefabList = new List<NamedPrefab>();
prefabList = new List<NamedPrefab>();
m_PrefabList.Add(new NamedPrefab(library[i].guid, null));
prefabList.Add(new NamedPrefab(library[i].guid, null));
}
}
else

{
var idx = m_PrefabList.FindIndex(item => item.imageGuid == library[i].guid);
tempList.Add(new NamedPrefab(library[i].guid, (idx != -1) ? m_PrefabList[idx].prefab : null));
var idx = prefabList.FindIndex(item => item.imageGuid == library[i].guid.ToString());
tempList.Add(new NamedPrefab(library[i].guid, (idx != -1) ? prefabList[idx].prefab : null));
m_PrefabList = tempList;
prefabList = tempList;
}
}
}
void OnTrackedImagesChanged(ARTrackedImagesChangedEventArgs eventArgs)

// Give the initial image a reasonable default scale
trackedImage.transform.localScale = new Vector3(trackedImage.size.x/2, trackedImage.size.x/2, trackedImage.size.x/2);
trackedImage.transform.localScale = new Vector3(trackedImage.size.x / 2, trackedImage.size.x / 2, trackedImage.size.x / 2);
AssignPrefab(trackedImage);
}

{
if (m_PrefabsDictionary.TryGetValue(trackedImage.referenceImage.guid, out GameObject prefab)){
if (m_PrefabsDictionary.TryGetValue(trackedImage.referenceImage.guid, out GameObject prefab))
{
#if UNITY_EDITOR
#if UNITY_EDITOR
[CustomEditor(typeof(MultiTrackedImageInfoManager))]
public class MultiTrackedImageInfoManagerInspector : Editor

if (EditorGUI.EndChangeCheck())
behaviour.OnLibraryChanged(library);
else if (HasLibraryChanged(library))
behaviour.OnLibraryChanged(library);
behaviour.OnLibraryChanged(library);
// Update current
// update current
m_ReferenceImages.Clear();
if (library)
{

}
serializedObject.ApplyModifiedProperties();
Undo.RecordObject(target, "Sync Library");
EditorUtility.SetDirty(target);
#endif
#endif
}
}

4
ProjectSettings/ProjectSettings.asset


16:9: 1
Others: 1
bundleVersion: 0.1
preloadedAssets:
- {fileID: 4800000, guid: e7c77f6eaab324a819efdc13b8125a39, type: 3}
- {fileID: -7479341934665344595, guid: e2f869774b12e400996eb546603602e3, type: 2}
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1

正在加载...
取消
保存