Forum rules - please read before posting.

Inconsistent errors after updating

Hi Chris,

I've been battling for a couple of days with some strange, and frustratingly inconsistent, issues since updating to AC 1.50b and Unity 5.3.1.

Sometimes, upon starting a scene, I receive two errors:

NullReferenceException: Object reference not set to an instance of an object
AC.KickStarter.OnAwake () (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:833)
AC.MultiSceneChecker.Awake () (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:26)

NullReferenceException: Object reference not set to an instance of an object
AC.MainCamera.Start () (at Assets/AdventureCreator/Scripts/Camera/MainCamera.cs:194)

This seems to interrupt the loading of the UFPS integration script, as I can't move my character, and the AC camera doesn't "wake up" and go to the UFPS camera. The game doesn't crash or hang, just that the UFPS character doesn't respond. This happens regardless of whether the UFPS player is in the scene or not, nor if it's specified in the AC settings as the player or not.

I believe that this is in some way related to the new changes to moveables remembering their positions, as I also get critical errors pinging objects with the Moveable_Drag script attached. There is one error per object.

NullReferenceException: Object reference not set to an instance of an object
AC.DragBase.Start () (at Assets/AdventureCreator/Scripts/Moveable/DragBase.cs:128)
AC.Moveable_Drag.Start () (at Assets/AdventureCreator/Scripts/Moveable/Moveable_Drag.cs:100)

I've performed tests where these objects are disabled, and sometimes that works - allows me to control the UFPS character - but not always. As I said, it's inconsistent. I attempted to create a new scene to demonstrate this issue but, of course, it doesn't always happen.

I've also noticed some issues with moveables whereby they don't always work. I can drag a drawer or cupboard door once, then not again. Or sometimes I need to click on another hotspot in the game before I can once again drag a moveable. That behaviour at least is consistent in my testing. Possibly related - I'm not sure.

Some of my moveables are on hinges and others are on drag tracks, but that doesn't seem to make any difference. I've tested with drag mode set to along a plane, and with starting position remembered on and off. I've tested with an attached Remember Moveable script, also no difference.

With this being such an inconsistent issue (sometimes the errors don't happen at all), I understand that you might have trouble replicating it. Please let me know if you need any more information. I have noticed that if I swap between scenes in the editor, the issue doesn't come up at first, but after changing scenes a few times at runtime (exit back to main menu, hit new game, do this a few times), then it's more likely to occur.


  • The first error was "secretly" fixed in v1.50c - but beyond giving an error message I don't think it has any other repercussions.

    The second error seems related to the order in which scripts are executed by Unity.  Try opening up Unity's Script Execution Order settings and moving MainCamera.cs down below the default.

    The third error seems along the same line - it might be that instead you want to move MultiSceneChecker.cs above the default.

    You're right that I'm having trouble replicating it - however if you can find out what combination of script ordering fixes the issue, there's a good chance I can do something about it.
  • Thanks as always Chris,

    I've updated to 1.50c and applied those two recommendations. No errors yet in my testing so here's holding thumbs it's done the job! MultiSceneChecker is set to -500 on the Script Execution Order, and MainCamera is set to 600 (directly after all of UFPS's scripts).

    I have a couple of other issues, which I suspect are related to UFPS, but I'll need to update to the very latest version of UFPS to make sure it's not the culprit. If I don't come right, there'll likely be another thread from me :P
  • Are both of those changes required, or just one?
  • I'm not sure - I did both to be safe.
  • I know - but would you mind trying both on their own?
  • Ugh, dammit, sorry - last night I rolled back to Unity 5.2.2 and deleted my project in 5.3.1. I thought I had it backed up but my syncing software overwrote that as well :( 

    I was having really sluggish performance in 5.3 (unrelated to AC) so I just decided to dump it altogether. If it's any help, I don't get any of these errors in Unity 5.2.2 using AC 1.50c.
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.