SetEnabledRecursive() public static method

public static SetEnabledRecursive ( GameObject go, bool enabled ) : void
go UnityEngine.GameObject
enabled bool
return void
Exemplo n.º 1
0
        private void DoRenderPreview()
        {
            GameObject gameObject = this.m_PreviewInstances[this.referenceTargetIndex];
            Bounds     bounds     = new Bounds(gameObject.transform.position, Vector3.zero);

            GameObjectInspector.GetRenderableBoundsRecurse(ref bounds, gameObject);
            float      num        = Mathf.Max(bounds.extents.magnitude, 0.0001f);
            float      num2       = num * 3.8f;
            Quaternion quaternion = Quaternion.Euler(-this.previewDir.y, -this.previewDir.x, 0f);
            Vector3    position   = bounds.center - quaternion * (Vector3.forward * num2);

            this.m_PreviewUtility.m_Camera.transform.position   = position;
            this.m_PreviewUtility.m_Camera.transform.rotation   = quaternion;
            this.m_PreviewUtility.m_Camera.nearClipPlane        = num2 - num * 1.1f;
            this.m_PreviewUtility.m_Camera.farClipPlane         = num2 + num * 1.1f;
            this.m_PreviewUtility.m_Light[0].intensity          = 0.7f;
            this.m_PreviewUtility.m_Light[0].transform.rotation = quaternion * Quaternion.Euler(40f, 40f, 0f);
            this.m_PreviewUtility.m_Light[1].intensity          = 0.7f;
            this.m_PreviewUtility.m_Light[1].transform.rotation = quaternion * Quaternion.Euler(340f, 218f, 177f);
            Color ambient = new Color(0.1f, 0.1f, 0.1f, 0f);

            InternalEditorUtility.SetCustomLighting(this.m_PreviewUtility.m_Light, ambient);
            bool fog = RenderSettings.fog;

            Unsupported.SetRenderSettingsUseFogNoDirty(false);
            GameObjectInspector.SetEnabledRecursive(gameObject, true);
            this.m_PreviewUtility.m_Camera.Render();
            GameObjectInspector.SetEnabledRecursive(gameObject, false);
            Unsupported.SetRenderSettingsUseFogNoDirty(fog);
            InternalEditorUtility.RemoveCustomLighting();
        }
Exemplo n.º 2
0
 private void SetPreviewCharacterEnabled(bool enabled, bool showReference)
 {
     if (this.m_PreviewInstance != null)
     {
         GameObjectInspector.SetEnabledRecursive(this.m_PreviewInstance, enabled);
     }
     GameObjectInspector.SetEnabledRecursive(this.m_ReferenceInstance, showReference && enabled);
     GameObjectInspector.SetEnabledRecursive(this.m_DirectionInstance, showReference && enabled);
     GameObjectInspector.SetEnabledRecursive(this.m_PivotInstance, showReference && enabled);
     GameObjectInspector.SetEnabledRecursive(this.m_RootInstance, showReference && enabled);
 }
Exemplo n.º 3
0
 private void CreatePreviewInstances()
 {
     this.DestroyPreviewInstances();
     if (this.m_PreviewInstances == null)
     {
         this.m_PreviewInstances = new List <GameObject>(base.targets.Length);
     }
     for (int i = 0; i < base.targets.Length; i++)
     {
         GameObject gameObject = EditorUtility.InstantiateForAnimatorPreview(base.targets[i]);
         GameObjectInspector.SetEnabledRecursive(gameObject, false);
         this.m_PreviewInstances.Add(gameObject);
     }
 }
 private void CreatePreviewInstances()
 {
     this.DestroyPreviewInstances();
     if (this.m_PreviewInstances == null)
     {
         this.m_PreviewInstances = new List <GameObject>(this.targets.Length);
     }
     for (int index = 0; index < this.targets.Length; ++index)
     {
         GameObject go = EditorUtility.InstantiateForAnimatorPreview(this.targets[index]);
         GameObjectInspector.SetEnabledRecursive(go, false);
         this.m_PreviewInstances.Add(go);
     }
 }