Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How to make sure that function repeats every frame in Edit mode (Scene tab)

Discussion in 'Editor & General Support' started by zim22, Aug 12, 2022.

  1. zim22

    zim22

    Joined:
    Feb 25, 2018
    Posts:
    44
    I have written an Editor plugin that needs to call a function every frame.

    Update() function can not be used - it is called only when I click with a mouse inside "Scene" view.

    According to the documentation this is a correct behavior of Update() in Edit mode:

    https://docs.unity3d.com/2021.3/Documentation/ScriptReference/ExecuteInEditMode.html


    My class is derived from MonoBehavior and [ExecuteInEditMode] attribute is added.

    I tried workarounds like calling StartCoroutine or InvokeRepeating in OnEnable() method but they behave the same way as Update() function - they get called only when scene is changed.

    Any ideas how to overcome this problem?
     
  2. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,495
  3. zim22

    zim22

    Joined:
    Feb 25, 2018
    Posts:
    44
    adamgolden likes this.