Exemple #1
0
        static void AddAdditionalLightData()
        {
            var lights = UnityObject.FindObjectsOfType(typeof(Light)) as Light[];

            foreach (var light in lights)
            {
                bool dirty = false;
                // Do not add a component if there already is one.
                if (light.GetComponent <ClusterAdditionalLightData>() == null)
                {
                    light.gameObject.AddComponent <ClusterAdditionalLightData>();
                    dirty = true;
                }

                if (light.GetComponent <AdditionalShadowData>() == null)
                {
                    light.gameObject.AddComponent <AdditionalShadowData>();
                    dirty = true;
                }

                if (light.GetComponent <CachedShadowData>() == null)
                {
                    light.gameObject.AddComponent <CachedShadowData>();
                    dirty = true;
                }

                if (dirty)
                {
                    EditorUtility.SetDirty(light.gameObject);
                }
            }
        }
Exemple #2
0
        static void AddAdditionalCameraData()
        {
            var cameras = UnityObject.FindObjectsOfType(typeof(Camera)) as Camera[];

            foreach (var camera in cameras)
            {
                // Do not add a component if there already is one.
                if (camera.GetComponent <HDAdditionalCameraData>() == null)
                {
                    camera.gameObject.AddComponent <HDAdditionalCameraData>();
                }
            }
        }
Exemple #3
0
        //[MenuItem("Internal/HDRP/Add \"Additional Light-shadow Data\" (if not present)")]
        static void AddAdditionalLightData()
        {
            var lights = UnityObject.FindObjectsOfType(typeof(Light)) as Light[];

            foreach (var light in lights)
            {
                // Do not add a component if there already is one.
                if (!light.TryGetComponent <HDAdditionalLightData>(out _))
                {
                    var hdLight = light.gameObject.AddComponent <HDAdditionalLightData>();
                    HDAdditionalLightData.InitDefaultHDAdditionalLightData(hdLight);
                }
            }
        }
        public void WeCanGetAllComponentsOnTheCurrentScene()
        {
            TestComponent comp  = new TestComponent();
            TestComponent comp1 = new TestComponent();
            TestComponent comp2 = new TestComponent();

            root.AddComponent(comp);
            child.AddComponent(comp1);
            childOfChild.AddComponent(comp2);

            UnityObject[] components = UnityObject.FindObjectsOfType(typeof(TestComponent));
            Assert.That(components, Is.Not.Null);
            Assert.That(components.Length, Is.EqualTo(3));
            Assert.That(components, Contains.Item(comp));
            Assert.That(components, Contains.Item(comp1));
            Assert.That(components, Contains.Item(comp2));
        }
Exemple #5
0
        static void AddAdditionalLightData()
        {
            var lights = UnityObject.FindObjectsOfType(typeof(Light)) as Light[];

            foreach (var light in lights)
            {
                // Do not add a component if there already is one.
                if (light.GetComponent <HDAdditionalLightData>() == null)
                {
                    light.gameObject.AddComponent <HDAdditionalLightData>();
                }

                if (light.GetComponent <AdditionalShadowData>() == null)
                {
                    light.gameObject.AddComponent <AdditionalShadowData>();
                }
            }
        }
Exemple #6
0
        private static bool checkRigidHands(out GameObject[] rigidHandObjects)
        {
            if (LeapProjectChecks.CheckIgnoredKey(IGNORE_RIGID_HANDS_CHECK_KEY))
            {
                rigidHandObjects = null;
                return(true);
            }

            rigidHandObjects = UnityObject.FindObjectsOfType <RigidHand>().Query()
                               .Select(x => x.gameObject).ToArray();
            if (rigidHandObjects.Length != 0 &&
                UnityObject.FindObjectOfType <InteractionManager>() != null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }