Hello, I have a problem where the movement of the camera does not work after doing this lecture. I can move the camera fine as a playing joining but as a host, the camera movements do not work. I tried hosting in Unity and the build and it seems to only affect the host, I can still add buildings and build units, hosting it’s just the camera.
Was wondering if I may have done something when changing codes.
Hi there, sorry you are having trouble. First thing I would check is if your CameraController script is the same as the instructors. Post it here if you want some help, the difference might not be obvious. Another thing to try, is sometimes removing and re-adding the camera makes a difference. Unity is fun that way.
Here’s the code, I doubled checked seems to be fine. It works for the player joining the game but not for the Host, also if the joining player leaves the game, the camera for the host works again.
You are right, code seems fine. Maybe it is related to how it is setup in the editor. Can you put a debug statement in Update() after the authority condition? Then first run the client in the editor, then the host in the editor with the second player joining via the build. Let me know when that debug gets called.
Hey there, I can’t really tell much about the debug from the video, sorry. Is UpdateCameraPosition() being called on the host during the game? Also, is this at all affected by whether the host is in the editor or the build?
I think it’s a problem in another script, to test it, I change the code so I can play single player and the camera works just fine as a host in the build or editor, so I must have something wrong in another script where if it’s more than one player in the game the camera only seems to work for one player.
Which I think is why when the joined player leaves like in the video, the camera for the host starts to work. Still looking to see where I may have missed up a code in the recent lecture.