Search Unity

Resolved Shader inside MonoBehaviour

Discussion in 'AR' started by ishb, Feb 5, 2021.

  1. ishb

    ishb

    Joined:
    Aug 9, 2020
    Posts:
    2
    For an AR App, I have click behaviour Mesh Shader, which I want to call at the start inside mono behaviour with a delay of 3 seconds. Is this possible?

    Right Now share is enabled by tick behaviour, but when I build and run the Unity program, there is no way to enable the mesh. I want to call this shader at runtime and update every frame for behaviour changes.
     
  2. FrankvHoof

    FrankvHoof

    Joined:
    Nov 3, 2014
    Posts:
    258
    Do you mean that you want to Run a method a certain amount of time after Start() has run?
    MonoBehaviour.Invoke() does this.
    Call Invoke(nameof(Method), timeout); in Start

    Edit: Make sure you also call CancelInvoke(nameof(Method)) in OnDisable/OnDestroy to prevent the Method from still being run even if the script was disabled/destroyed before your timeout.