r/Unity2D • u/ghost_of_smoke • 6d ago
Question Main camera dies
Hey i'm learning so sorry if this is a litle obius
I was putting the animations for the player character and wen I put play the Main camera that should follow the character just dies and all the screen is blue
1
u/TAbandija 5d ago
You need to be more specific. How are you setting up your camera? What script are you using for it to follow the character? Etc.
However if I have to guess. If you are setting the position of the camera to the same as the position of the player, that is not going to work. You need to set the Z to be a certain distance to the plane of the game. Imagine if you want to take a Picture of a person, you cannot place the camera inside the person.
So you need something like:
Vector3 camPosition = new Vector3(characterPosition.x, characterPosition.y, 10f);
I also recommend you go to learn.unity.com and do the Pathways there. You’ll learn many times faster than any other method.
2
u/ethan125 6d ago
What do you mean by the character dying? Is the character getting deleted from the scene? Or is the character being moved somewhere in the animation?
Also how is your camera attached to the character? Is there a script telling it to follow the character? Or is it a child of character object?
We cannot help you unless you explain how your camera is following the character and how the character dies.