top of page

Coding skills: Part 4

Finishing the camera angle and opening up the project the next day, I came across a problem. Now, I still have not found a solution to this problem yet, but in essence once the game started the camera was not following the player anymore, and was stuck at one place. I tried changing up a couple of aspects about the code such as switching to using a singleton, which essentially is like an anchor for only one kind of object that can exist, and that any other part of the code can access it. This didn't end up fixing the issue though, so I tried creating a completely separate game object called Cam1, and put all the other camera pivots, main camera and other sections into the empty. What I thought was happening was the code could not identify what to follow when the game first opened, but that could not be the case since when I removed and reattached the camera component and tried it a second time, it worked. This meant it was something specifically to do with how the script was loading in when the game opened, and how it could not track the player before being reattached. I have tried lots of solutions, but nothing has worked as of yet. If anyone has a solution to this sort of issue, please do let me know. I will link a section of the code and a picture of the issue down below.


______________________________________________________________________________________________________



ree

Image Source: The Unity Game (The camera not following the player)


ree

Image Source: The Unity Game (A snippet of the code)

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page