Forum rules - please read before posting.

Problem switching scene with UCC player on AC 1.73.3

I'm trying to load a second scene after first one ends but get following error

NullReferenceException: Object reference not set to an instance of an object
AC.StateHandler.get_gameState () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:488)
AC.StateHandler.IsInGameplay () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:664)
AC_UCC_Character.Update () (at Assets/AdventureCreator/Downloads/UCC integration/Scripts/AC_UCC_Character.cs:53)

This is line 53.
if (!KickStarter.stateHandler.IsInGameplay ())

I only have one player (UCC) and have disabled player switching. The player gets loaded in the scene when it gets loaded and both scenes play fine by themselves. No errors of any kind.

Only issue going from one scene to another when I do a scene switch. I can see that the new scene is loading and the player is in the Don't destroy on loading section so close to working.

Any suggestions on tracking this down.


  • What is your AC version, and is this when using AC's Scene: Switch Action to perform the switch?

    In the latest release, the StateHandler script's line 488 should read:

    if (KickStarter.playerInteraction.InPreInteractionCutscene) return GameState.Cutscene;

    Is this true for you?

    If this is giving you a NRE error, then it's likely that you have no PlayerInteraction component in the scene. This should be part of the GameEngine object that gets spawned when you use AC's Scene Manager to convert a scene into an AC one.

    Is this object, and component, present in the two scenes - both in the scene file while editing and, crucially, still there at the time the error occurs?

  • I'm on release 1.73.3 so not 1.73.4. Line 488 is the same. In both scenes the playerinteraction component is there. There is StateManager in the scene when the error occurs, but the GameEngine object has not been spawned. If I delete the player before I load the new scene things works.

    The player was spawned in the first scene as expected. Anyway that will get me past the issue. Must be one of the add on scripts on the player. Will try to track down when I get some time,

  • Try using local Players in each scene file - as opposed to spawning the Player from the Settings Manager.

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.