TrackingImageDatabasePreprocessBuild.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233
  1. /****************************************************************************
  2. * Copyright 2019 Nreal Techonology Limited. All rights reserved.
  3. *
  4. * This file is part of NRSDK.
  5. *
  6. * https://www.nreal.ai/
  7. *
  8. *****************************************************************************/
  9. namespace NRKernal
  10. {
  11. using UnityEditor;
  12. /// <summary> A tracking image database preprocess build. </summary>
  13. internal class TrackingImageDatabasePreprocessBuild : PreprocessBuildBase
  14. {
  15. /// <summary> Executes the 'preprocess build' action. </summary>
  16. /// <param name="target"> Target for the.</param>
  17. /// <param name="path"> Full pathname of the file.</param>
  18. public override void OnPreprocessBuild(BuildTarget target, string path)
  19. {
  20. var augmentedImageDatabaseGuids = AssetDatabase.FindAssets("t:NRTrackingImageDatabase");
  21. foreach (var databaseGuid in augmentedImageDatabaseGuids)
  22. {
  23. var database = AssetDatabase.LoadAssetAtPath<NRTrackingImageDatabase>(
  24. AssetDatabase.GUIDToAssetPath(databaseGuid));
  25. TrackingImageDatabaseInspector.BuildDataBase(database);
  26. database.BuildIfNeeded();
  27. }
  28. }
  29. }
  30. }