-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomInpectorPrefabPreview
More file actions
40 lines (32 loc) · 1 KB
/
Copy pathCustomInpectorPrefabPreview
File metadata and controls
40 lines (32 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//create a custom inspector for the chunks script
//displays a 3d preview of an obj
if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
using UnityEngine.Events;
[CustomEditor(typeof(Chunks))]
public class ChunksEditor : Editor
{
private PreviewRenderUtility _previewRenderUtility;
Editor gameObjectEditor;
public override void OnInspectorGUI()
{
DrawDefaultInspector();
Chunks myGameEvent = (Chunks)target;
//GUILayout.Space(10f);
//if (GUILayout.Button("Test"))
//{
// Debug.Log("Test");
// //myGameEvent.Active();
//}
//GUILayout.Box(AssetPreview.GetAssetPreview(myGameEvent.chunks[0].chunk));
GameObject preview = myGameEvent.chunks[0].chunk;
if (preview)
{
if (gameObjectEditor == null)
gameObjectEditor = Editor.CreateEditor(preview);
gameObjectEditor.OnPreviewGUI(GUILayoutUtility.GetRect(100, 100), EditorStyles.whiteLabel);
}
}
}
#endif