Beispiel #1
0
            public void FindOrCreate3DCubeGameObject()
            {
                var gameObject = GameObject.Find(gameObjectName);

                Assert.IsNull(gameObject);

                gameObject = CustomEditorExtensions.FindOrCreateGameObjectFromAssetMenu(gameObjectName, gameObjectMenuPath);

                Assert.IsNotNull(gameObject);

                gameObject = GameObject.Find(gameObjectName);

                Assert.IsNotNull(gameObject);
            }
        internal static void SetupARFoundation()
        {
            var sessionOrigin =
                CustomEditorExtensions.FindOrCreateGameObjectFromAssetMenu(sessionOriginName, sessionOriginMenuPath);

            sessionOrigin.AddOrGetComponent <ARRaycastManager>();

            var mainCamera = GameObject.Find("Main Camera");

            if (mainCamera)
            {
                Object.DestroyImmediate(mainCamera);
            }

            var session = CustomEditorExtensions.FindOrCreateGameObjectFromAssetMenu(sessionName, sessionMenuPath);
        }
Beispiel #3
0
        internal static void SetupARFoundationComponents()
        {
            var camera        = GameObject.Find("AR Camera");
            var cameraManager = camera.AddOrGetComponent <ARCameraManager>();

            cameraManager.lightEstimationMode = LightEstimationMode.AmbientIntensity;

            var light = CustomEditorExtensions.FindOrCreateGameObjectFromAssetMenu(directionalLightName,
                                                                                   directionalLightMenuPath);

            var lightComponent = light.GetComponent <Light>();

            lightComponent.color   = new Color(1, 0.957f, 0.839f, 1);
            lightComponent.shadows = LightShadows.Soft;

            var lightEstimation = light.AddOrGetComponent <ARLightEstimation>();

            lightEstimation.cameraManager = cameraManager;
        }
Beispiel #4
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);
            }
        }