Page 1 of 1
Camera not following player after loading from editor
Posted: Sat Apr 22, 2023 2:40 am
by Reed237
Hi, I'm using the top-down engine with the dialogue system when I load the game while in play mode it works, but when exit the play mode and reenter the camera doesn't follow the player.
Re: Camera not following player after loading from editor
Posted: Sat Apr 22, 2023 9:32 am
by Tony Li
Hi,
I don't think this is related to the Dialogue System.
Have you by any chance disabled domain reloading and scene reloading? I don't know that TDE supports disabling of either of those options.
Re: Camera not following player after loading from editor
Posted: Sun Apr 23, 2023 6:10 am
by Reed237
I don't remember seeing any of those. maybe this is something I can fix with coding
Re: Camera not following player after loading from editor
Posted: Sun Apr 23, 2023 8:04 am
by Tony Li
Hi,
You shouldn't need to spackle over the issue with more code.
Select menu item Edit > Project Settings. In the Editor section, scroll down to Enter Play Mode Options. Is that checkbox ticked and the Reload Domain and Reload Scene checkboxes UNticked?
Re: Camera not following player after loading from editor
Posted: Tue May 02, 2023 4:16 am
by Reed237
sorry for the late reply but I tried it and they both were unticked. I also tried with them ticked but it still didn't work.
Re: Camera not following player after loading from editor
Posted: Tue May 02, 2023 8:45 am
by Tony Li
Hi,
Please click on the red errors in the Console window, press Ctrl+C to copy their details to the clipboard, and paste them into a reply. Always keep an eye on the Console window. Ideally it should never report any red errors or yellow warnings. If there are any red errors or yellow warnings, fix them first before continuing with development.
We can also test this without the Dialogue System in your scene. Make a test copy of your scene. In the test copy, remove the Dialogue Manager GameObject. Then play the scene. If the camera still doesn't follow the player, it's not the Dialogue System. But I will still try to help you. In this case, please paste in the red errors from the Console window.
Re: Camera not following player after loading from editor
Posted: Tue May 02, 2023 11:12 pm
by Reed237
this is what it's saying.
NullReferenceException: Object reference not set to an instance of an object
MoreMountains.TopDownEngine.CinemachineCameraController.StartFollowing () (at Assets/TopDownEngine/Common/ScriptsCinemachine/Camera/CinemachineCameraController.cs:73)
MoreMountains.TopDownEngine.TopDownCinemachineZone2D+<EnableCamera>d__4.MoveNext () (at Assets/TopDownEngine/Common/ScriptsCinemachine/Camera/TopDownCinemachineZone2D.cs:46)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <4746c126b0b54f3b834845974d1a9190>:0)
Re: Camera not following player after loading from editor
Posted: Wed May 03, 2023 8:40 am
by Tony Li
Did that red error message come from a scene in which you've removed the Dialogue Manager GameObject (i.e., not using the Dialogue System)? This will help narrow down the problem.
In either case, can you send a
reproduction project to tony (at) pixelcrushers.com?
Re: Camera not following player after loading from editor
Posted: Wed May 03, 2023 6:47 pm
by Reed237
hey here's the project. all you have to do is save it and try to load it when entering play mode
[removed]
Re: Camera not following player after loading from editor
Posted: Wed May 03, 2023 9:10 pm
by Tony Li
Hi,
The Load button doesn't work in the project you sent me. However, looking at your video, are you moving your player character far enough to the edge to make the camera move? It only moves when the player is near the edge of the screen.
I recommend also cleaning up the Console window. Resolve all red errors and yellow warnings, and remove all Debug.Log lines that spam the Console, such as "ABILITYYY" in CharacterAbility.HandleInput() and "HEALTH BAR HIT" in Health.UpdateHealthBar(). Also check for null in StatsManager.UpdateCurrLevelUI().