Forum rules - please read before posting.

Issue after upgrading to 1.85.1 Kickstarter.player is null

Hiya. We've been working on this project for a year or so and as we are wrapping things up we had to upgrade unity version due to the unity security issue bug. That means we had to upgrade AC as well. We were using 1.72.4 and now we moved to 1.85.1 version and a number of issues has popped up that have broken our game. A big number of the issues is due to the fact that kickstarter.player returns null when it's run in a start function of a script. Even when I'm already playing the game, so my character has loaded, when I switch a scene, if that scene has scripts that try to access kickstarter.player, it returns null which breaks the game. What is the correct way to access the player now?

Comments

  • edited November 2025

    Welcome to the community, @fruitpunchsamuraigr.

    Are you using Player-switching, a local Player in the scene, and/or the use of Addressables to spawn them? These will all affect exactly when the Player variable is set and available to use.

    It might be enough for your script to simply have a positive Execution Order for it to be called after AC's initialisation process, but the most reliable way to ensure Player references is to hook into the OnPlayerSwitch event in OnEnable if the value is currently null, i.e.:

    void Start()
    {
        if (KickStarter.player)
        {
            OnSetPlayer(KickStarter.player);
        }
        else
        {
            EventManager.OnSetPlayer += OnSetPlayer;
        }
    }
    
    void OnDestroy()
    {
        EventManager.OnSetPlayer -= OnSetPlayer;
    }
    
    void OnSetPlayer(Player player)
    {
        //
    }
    
  • Thank you very much for your reply @ChrisIceBox . We've been slowly working through fixing all the different issues that have popped up since our update. One of the last ones that I can't seem to figure out is how to sort the save files by time updated. I have the bool in the settings manager checked but it doesn't work as intended. Save ordering gets mixed up, sometimes the new save will go on top of the list but the save before that just gets randomly rearranged. I tried changing the code at SaveSystem.cs or create my own script to sort them, nothing seems to work. Do you have any suggestions of how to go about this?

  • What platform are you building to, and are you using a custom save-file handler?

    There was a fix applied to the way update times were recorded, but it may be that you'll need to rely on new saves rather than existing ones for it to kick in.

    Are some of the saves in your list made before the update? If so, use the Save-game Manager to clear them and try it with all-new save files.

    Otherwise, share screenshots of your Save-game settings, and your Save/Load Menu/Element properties and I'll see if I can spot what's wrong.

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.