Forum rules - please read before posting.

How to use OnLoad ?

How to use properly:
AC.EventManager.Call_OnLoad(FileAccessState.after, 0, SaveFile) += OnSceneLoaded;

what should I put instead of SaveFile ?
Tried to declare save file but it doesn't work or I'm doing it wrong...

Comments

  • Call_OnLoad is a function that fires one of three events based on the FileAccessState value. It should be called by AC internally when a file is loaded - whereas custom scripts should only hook into the events themselves. In the case of the game successfully loading a save file, the event is OnFinishLoading.

    private void OnEnable () { EventManager.OnFinishLoading += OnFinishLoading; }
    private void OnDisable () { EventManager.OnFinishLoading -= OnFinishLoading; }
    
    private void OnFinishLoading ()
    {
        // Save file loaded
    }
    

    A tutorial on working with custom events can be found here, and a list of save-related events can be found in the Manual's "Save scripting" chapter.

  • You are mind reader! This is exactly what I was looking for.
    Thanks a lot.

    Greetings from Harvester Games team.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.