I created a virtual camera that looks at a gameobject called “Target”.
Everything is working fine while in editor. The target is always in the center of the screen.
But once I build the project and run it, the camera position (or is it rotation? basically where it looks at) is stuck in the starting position.
This seems like a bug to me or maybe a case I didn’t consider.
If you need specific code or examples I can both show you my code as well as upload footage.
(I didn’t so far because I really have no idea what could be the problem here.)
EDIT: I don’t know if it helps, but the camera is using a dolly track. (so it’s moving all the time, hence the look at).
It’s difficult to say with this information.
Let’s try with a photo of your hierarchy, photo of the inspector for your vcams and main camera. Maybe we can see something from that.
I think, you just need to set a Follow target for Tracked Dolly.
In general:
Position of the camera is determined by Body, and Body uses Follow target to calculate the position.
Rotation of the camera is determined by Aim, and Aim uses Look At target to calculate the rotation.
Unfortunately, this doesn’t solve the problem.
It still works in the editor but not in runtime.
What are possible differences between both environments? It feels like part of the script isn’t executed properly.
EDIT:
I checked the rotation of the main camera and the vcam as well as lookAt and Follow in both environments. LookAt and Follow are pointing to target (as they should) but in the runtime build the rotation of neither the main camera nor the vcam changes.
EDIT2:
I recorded the exact same camera movement in both environments:
I honestly don’t know what to look for since it’s working in the editor… It’s quite hard to debug as well.
Basically I want to be able to move around in the world (using the SimpleCameraController) and set waypoints, which are later used to create a tracked dolly path.
Every functionality of the SCC is skipped once a track is created.
What bothers me a lot is the fact that it does work in the editor game view but not after building it.
Should I just try disabling this and that in the blue or is there an actual way of debugging the runtime?
Although I still don’t completely understand the issue and why it worked in the editor but not in runtime I managed to fix it:
Instead of a HardLockToTarget