Home>

Thing I want to do
I want to know how to terminate the ExecuteInEditMode script

I was told that there is a wonderful function called ExecuteInEditMode
I'm trying right away
It worked fine, but I can't stop it at any time

Even if you delete the prefab or run the DETOROY script
Debug.Log("OnSceneGUI" + e.type);log keeps working
I want to stop this I tested with the following source

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
public class EditModeKeyInput: MonoBehaviour
{
    void OnEnable()
    {
        SceneView.onSceneGUIDelegate += OnSceneGUI;
    }
    void OnSceneGUI(SceneView scene)
    {
        var e = Event.current;
        Debug.Log("OnSceneGUI" + e.type);
    }
}

How can I end ExecuteInEditMode
Thank you.

Addendum
I lost the object that has ExecuteInEditMode attached as in the image below, but it doesn't stop

  • Answer # 1

    ExecuteInEditMode is when there are no objects attached
    OnDestroy should be called and Update etc should all stop

    If you do not want to delete the object, I think that it is possible to prepare some kind of flag and process it only while the flag is set