0

Is there a way to execute a script before OnEnable of the ScriptableObjects are called? I tried RuntimeInitializeLoadType.BeforeSplashScreen and RuntimeInitializeLoadType.BeforeSceneLoad, but they are called after OnEnable.

3
  • Awake() is called before OnEnable(). Why not simply using it? Commented Aug 11, 2019 at 14:09
  • 1
    I have the sneaking suspicion that you have the xy problem here. Is running code before OnEnable on a ScriptableObject your end goal, or are you using it to try to solve a different problem? Commented Aug 11, 2019 at 14:14
  • I want to be able to update my binary data (game progress) format, but I need to do that before the OnEnable method is called. Commented Aug 11, 2019 at 15:33

1 Answer 1

1

Yes, you can use Awake(), which is called on scripts before OnEnable.

Note that these messages work slightly differently on ScriptableObjects than on MonoBehaviours - there's a good thread over at Unity's forums discussing ScriptableObject events.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.