private GameObjectInspector.PreviewData GetPreviewData()
 {
     GameObjectInspector.PreviewData previewData;
     if (!this.m_PreviewInstances.TryGetValue(this.referenceTargetIndex, out previewData))
     {
         previewData = new GameObjectInspector.PreviewData(base.target);
         this.m_PreviewInstances.Add(this.referenceTargetIndex, previewData);
     }
     return(previewData);
 }
 public override void ReloadPreviewInstances()
 {
     foreach (KeyValuePair <int, GameObjectInspector.PreviewData> current in this.m_PreviewInstances)
     {
         int key = current.Key;
         if (key <= base.targets.Length)
         {
             GameObjectInspector.PreviewData value = current.Value;
             value.UpdateGameObject(base.targets[key]);
         }
     }
 }
        private void DoRenderPreview()
        {
            GameObjectInspector.PreviewData previewData = this.GetPreviewData();
            Bounds bounds = new Bounds(previewData.gameObject.transform.position, Vector3.zero);

            GameObjectInspector.GetRenderableBoundsRecurse(ref bounds, previewData.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);

            previewData.renderUtility.camera.transform.position    = position;
            previewData.renderUtility.camera.transform.rotation    = quaternion;
            previewData.renderUtility.camera.nearClipPlane         = num2 - num * 1.1f;
            previewData.renderUtility.camera.farClipPlane          = num2 + num * 1.1f;
            previewData.renderUtility.lights[0].intensity          = 0.7f;
            previewData.renderUtility.lights[0].transform.rotation = quaternion * Quaternion.Euler(40f, 40f, 0f);
            previewData.renderUtility.lights[1].intensity          = 0.7f;
            previewData.renderUtility.lights[1].transform.rotation = quaternion * Quaternion.Euler(340f, 218f, 177f);
            previewData.renderUtility.ambientColor = new Color(0.1f, 0.1f, 0.1f, 0f);
            previewData.renderUtility.Render(true, true);
        }