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.

42 lines
959 B

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