Hi, I'm coming back to my work on this after a few months, I've updated, I've reassigned all the 'managers' and some of the scenes work fine. Some, however, are closing out immediately upon loading or entering from another scene with the following error:
NullReferenceException: Object reference not set to an instance of an object
AC.Char.get_CanPhysicallyRotate () (at Assets/AdventureCreator/Scripts/Character/Char.cs:3736)
AC.Char.get_TransformForward () (at Assets/AdventureCreator/Scripts/Character/Char.cs:3777)
AC.Char.PrepareSpriteChild (Boolean isTopDown, Boolean isUnity2D) (at Assets/AdventureCreator/Scripts/Character/Char.cs:2580)
AC.Player.Initialise () (at Assets/AdventureCreator/Scripts/Character/Player.cs:113)
AC.KickStarter.OnAwake () (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:996)
AC.MultiSceneChecker.Awake () (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:47)
Comments
2) Are you relying on multiple player prefabs?
3) What animation engine are you using for your characters?
Open up Char.cs, and find line 3736:
if (animEngine.isSpriteBased && !turn2DCharactersIn3DSpace && motionControl != MotionControl.Manual)
Immediately above it, insert the following:
if (animEngine == null) ResetAnimationEngine ();
Does that resolve the issue?
Thanks for the help, very much appreciated.
@Martin: It's out now - v1.61.2 fixes the issue.
Hello.
I got very similar error with AC v. 1.66.8 after upgrade from 1.62.6
During gameplay when loads the scene where Player already presents I get:
Welcome to the community, @AHPyXA.
In Char.cs, replace line 3082:
with:
Does that resolve the issue?
Yes. I can confirm this resolve the issue for me.
Thank you very much, @ChrisIceBox
Hi all,
I believe this is a similar issue, any ideas? Thanks for any help in advance!
NullReferenceException: Object reference not set to an instance of an object
AC.AdvGame.GetScreenNavMesh (UnityEngine.Vector3 targetWorldPosition) (at Assets/AdventureCreator/Scripts/Static/AdvGame.cs:1060)
AC.PlayerStart.SetPlayerStart () (at Assets/AdventureCreator/Scripts/Navigation/PlayerStart.cs:67)
AC.SceneSettings.FindPlayerStart () (at Assets/AdventureCreator/Scripts/Game engine/SceneSettings.cs:166)
AC.SceneSettings.OnStart () (at Assets/AdventureCreator/Scripts/Game engine/SceneSettings.cs:130)
AC.MultiSceneChecker.Start () (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:72)
Don
It's unrelated. What version of AC/Unity are you using, at what point does the error occur, and what is the result of it showing?
The stacktrace suggests that your MainCamera is not tagged as "MainCamera" in its Inspector - is this the case?
Hi Chris,
Thanks for the help. I started over and added a game camera component, set it to main camera and added the main camera script to it and all is good now.
Does that essentially restore the maincamera? Or am I supposed to restore the maincamera in a different way?
The GameCamera and MainCamera should be separate - don't try to convert one into the other.
The AC MainCamera prefab can be found in Assets/AdventureCreator/Prefabs/Automatic. It should be placed in your scene for you when organising scene objects in the Scene Manager, but you can drop it in there manually from the prefabs folder as well.
I got a related problem only in some scenes for some reason:
NullReferenceException: Object reference not set to an instance of an object
AC.SceneChanger.PrepareSceneForExit (System.Boolean isInstant, System.Boolean saveRoomData, System.Boolean doOverlay) (at Assets/AdventureCreator/Scripts/Game engine/SceneChanger.cs:1041)
AC.SceneChanger.ChangeScene (System.Int32 nextSceneIndex, System.Boolean saveRoomData, System.Boolean forceReload, System.Boolean doOverlay) (at Assets/AdventureCreator/Scripts/Game engine/SceneChanger.cs:253)
AC.ActionScene.Run () (at Assets/AdventureCreator/Scripts/Actions/ActionScene.cs:127)
AC.ActionList+d__41.MoveNext () (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:428)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <58a34b0a618d424bb5fc18bb9bcdac20>:0)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:379)
AC.ActionList:ProcessActionEnd(ActionEnd, Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:580)
AC.ActionList:EndAction(Action) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:539)
AC.d__41:MoveNext() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:493)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:379)
AC.ActionList:BeginActionList(Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:346)
AC.ActionList:Interact(Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:247)
AC.ActionList:Interact() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:210)
AC.SceneSettings:PlayStartCutscene() (at Assets/AdventureCreator/Scripts/Game engine/SceneSettings.cs:332)
AC.SceneSettings:OnStart() (at Assets/AdventureCreator/Scripts/Game engine/SceneSettings.cs:110)
AC.SaveSystem:InitAfterLoad() (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:691)
AC.MultiSceneChecker:Start() (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:62)
No idea what to do I'm not really a programmer...
What are your AC and Unity versions, and at what point does this message display?