Hyluss

[Unity] CustomEditor

Feb 14th, 2018
267
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEditor;
  4. using UnityEngine;
  5.  
  6. [CustomEditor(typeof (MapGenerator))]
  7. public class MapGeneratedEditor : Editor {
  8.  
  9.     public override void OnInspectorGUI()
  10.     {
  11.         MapGenerator mapGenerator = (MapGenerator)target;
  12.         if (DrawDefaultInspector())
  13.         {
  14.             if(mapGenerator.autoUpdate)
  15.             {
  16.                 mapGenerator.GenerateMap();
  17.             }
  18.         }
  19.         if(GUILayout.Button("Generate"))
  20.         {
  21.             mapGenerator.GenerateMap();
  22.         }
  23.  
  24.     }
  25.  
  26. }
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment