Search Unity

Possible to attach method to Load Scene In Editor instructions?

Discussion in 'Editor & General Support' started by AntFitch, May 17, 2017.

  1. AntFitch

    AntFitch

    Joined:
    Jan 31, 2012
    Posts:
    243
    Tried to post in Answers, but Topics search doesn't seem to be working right now so...

    I'm creating an editor asset.

    When I load a scene in the Unity Editor, I need all GameObjects that contain a script called Visuals to refresh. This must happen without my asset editor being open in the editor. Also, I must assume that the inspector for one of these GameObjects is not open.

    I have a method called RefreshVisuals() that I call from the Inspector and from the custom Editor for the asset. It works great and ensures that if a visual element is changed in the custom editor or inspector, the graphics attached to the GameObject are also changed. But now I need to figure out how to make sure that when a scene loads in the Unity Editor that these GameObjects are immediately refreshed so that they display the correct visuals.

    Is there a way to attach a method to the default load-scene-in-editor routine that Unity uses?
     
  2. AntFitch

    AntFitch

    Joined:
    Jan 31, 2012
    Posts:
    243