SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
922 B

4 years ago
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace ARLocation
  5. {
  6. [CreateAssetMenu(fileName = "PrefabDb", menuName = "AR+GPS/PrefabDatabase")]
  7. public class Data : ScriptableObject
  8. {
  9. [System.Serializable]
  10. public class PrefabDatabaseEntry
  11. {
  12. /// <summary>
  13. /// The `MeshId` associated with the prefab. Should match a `MeshId` from the data created
  14. /// the Web Map Editor (https://editor.unity-ar-gps-location.com).
  15. /// </summary>
  16. public string MeshId;
  17. /// <summary>
  18. /// The prefab you want to associate with the `MeshId`.
  19. /// </summary>
  20. public GameObject Prefab;
  21. }
  22. public List<PrefabDatabaseEntry> Entries;
  23. public GameObject GetEntryById(string Id)
  24. {
  25. GameObject result = null;
  26. foreach (var entry in Entries)
  27. {
  28. if (entry.MeshId == Id)
  29. {
  30. result = entry.Prefab;
  31. break;
  32. }
  33. }
  34. return result;
  35. }
  36. }
  37. }