Exemple #1
0
            public void FindOrCreateScriptableObject()
            {
                var asset = AssetDatabase.LoadAssetAtPath <ScriptableObject>(scriptableObjectAssetPath);

                Assert.IsNull(asset);

                asset = CustomEditorExtensions.FindOrCreateScriptableObjectAtPath <ScriptableObject>(scriptableObjectAssetPath);

                Assert.IsNotNull(asset);

                asset = AssetDatabase.LoadAssetAtPath <ScriptableObject>(scriptableObjectAssetPath);

                Assert.IsNotNull(asset);
            }
Exemple #2
0
        private static void SetupARFoundationObjectDetection()
        {
            var sessionOrigin =
                CustomEditorExtensions.FindOrCreateGameObjectFromAssetMenu(sessionOriginName, sessionOriginMenuPath);

            var trackedObjectManager = sessionOrigin.AddOrGetComponent <ARTrackedObjectManager>();

            trackedObjectManager.trackedObjectPrefab =
                AssetDatabase.LoadAssetAtPath <GameObject>(AutoPopulateScene.cubePrefabPath);

            var referenceLibrary =
                CustomEditorExtensions.FindOrCreateScriptableObjectAtPath <XRReferenceObjectLibrary>(
                    objectReferenceLibraryAssetPath);

            try
            {
                trackedObjectManager.referenceLibrary = referenceLibrary;
            }
            catch (Exception err)
            {
                Debug.LogWarning(err);
            }
        }