How to lock the camera on Y axis?
I'm really new to programming so sorry for the dumb question, but I've been trying to get this to work for hours now and can't seem to get it to work, on google I found a solution but I can't seem to get it to work for me.
The code I found was:
function LateUpdate()
{
camera.main.transform.position.y = 2.0;
}
The error I get here is: 'Component' does not contain a definition for 'main' and no extension method 'main' accepting a first argument of type 'Component' could be found. I have no idea what this means. Any help is much appreciated
Vector3 position = Camera.main.transform.position ;
position.y = 2.0;
Camera.main.transform.position = position;
Your answer
Follow this Question
Related Questions
Rect or Camera transform? 0 Answers
2D box collider always detecting player,2D Box colliders detecting player when he is not there 1 Answer
I can not see the title screen of my game 0 Answers
How to scale Character/ Sprite size relative to camera?,How to make sprite bigger towards camera? 0 Answers
camera not following target after reload 0 Answers