I am going through my very first tutorial with Unity. I have to say I am super excited to be giving Unity a try!
I am trying out this tutorial on RTS camera movement.
The working program will have to camera scroll when the cursor hits screen edge. This is not happening for me.
Here is what confusing me when diagnosing the problem. When I press play my mouse cursor is not even bound to the game preview window. So how could I do screen edge scrolling with the mouse cursor not even bound to the play window. By default is the mouse input not even tracked into the game preview?
This confusion really prevents me for determining where I should start debugging first…
I have verified that mode code is the same as the tutorial.
The editor will not restrict the mouse to the game window. That code is just checking if the mouse is near the edge and then updating the camera position.
check that the mouse position is reading within the bounds the code is checking.
transform is a reference to the GameObjects Transform. The Transform component is present on every GameObject, and contains position, rotation and parent/child data.
The script is attached to a GameObject. You can instantiate as many of those GameObjects as you like. When script calls GetComponent it is only looking at the GameObject it is attached to.
So, that call returns the Player script on that GameObject.