Created
November 14, 2020 23:10
-
-
Save nns2009/b2e03a1aadcbf9072ad3ec3ba7a4aa2d to your computer and use it in GitHub Desktop.
Unity custom editor for parametric objects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This script is the common part of the set up to use parametric objects in Unity: | |
// Watch the video-tutorial with explanation here: | |
// https://youtu.be/KCDYdQUufhs | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEditor; | |
using UnityEngine; | |
[CustomEditor(typeof(Room))] | |
public class RoomEditor : Editor | |
{ | |
public override void OnInspectorGUI() | |
{ | |
var room = (Room)target; | |
EditorGUI.BeginChangeCheck(); | |
base.OnInspectorGUI(); | |
if (EditorGUI.EndChangeCheck() || GUILayout.Button("Recreate")) | |
{ | |
room.Recreate(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment