I have this simple editor script that create two buttons :
When I’m using a breakpoint and then click on one of the buttons it’s getting to the line inside for example to the line :
Generate.GenerateNewMap();
The script :
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor(typeof(TileMap))]
public class CustomButton : Editor
{
public override void OnInspectorGUI()
{
TileMap Generate = (TileMap)target;
if (GUILayout.Button("Generate Map", GUILayout.Width(100), GUILayout.Height(30)))
{
Generate.GenerateNewMap();
}
DrawDefaultInspector();
if (GUILayout.Button("Destroy Map", GUILayout.Width(100), GUILayout.Height(30)))
{
Generate.DestroyMap();
}
}
}
Then I created another script same folder in the assets same idea but when using a breakpoint it’s never get inside :
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(TileMap))]
public class TestEditor : Editor
{
public override void OnInspectorGUI()
{
TileMap Generate = (TileMap)target;
Debug.Log("Testing!");
}
}
It’s never get to the lines :
TileMap Generate = (TileMap)target;
Debug.Log("Testing!");
I have another editor script is a bit long but it’s not working either.
When I add a breakpoint to the editor script with the buttons and then click on Attach to Unity then on the left it will be red circle so the breakpoint will work :
but on the script I created for testing when I add a breakpoint it’s showing a yellow circle on the left with some message :
I don’t understand it. What is the difference ? Why the first editor script is working and the breakpoints are working and on the second one it’s not ? They are both in the same Editor folder.