Skip to content

Instantly share code, notes, and snippets.

@nns2009
Created November 14, 2020 23:10
Show Gist options
  • Save nns2009/b2e03a1aadcbf9072ad3ec3ba7a4aa2d to your computer and use it in GitHub Desktop.
Save nns2009/b2e03a1aadcbf9072ad3ec3ba7a4aa2d to your computer and use it in GitHub Desktop.
Unity custom editor for parametric objects
// 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