Defining a starting position for a gameobject?
Im a total noob to programming and im having issues. I want my object to start at 0,0,0 (xyz) position when the game begins and i cant find out how to do this. So far this is what ive got but when i press the play button nothing happens and the object does not appear in the center of the screen. Any help?
public class Movement : MonoBehaviour {
public GameObject snakeHead;
// Use this for initialization
void Start ()
{
snakeHead.transform.position = new Vector3(0, 0, 0);
}
}
Answer by Jessespike · Apr 08, 2016 at 08:29 PM
0,0,0 is in worldspace, if the camera was moved, then the object will not be in the center of the screen. Did you setup a GameObject to snakehead in the inspector?
Should watch many of the tutorials, they cover all of the essentials to know: Unity Tutorials
Ok thanks will watch the tutorials. Couldnt find anything anywhere else so...
Your answer
Follow this Question
Related Questions
Choosing the first scene to load 2 Answers
Cant find component after scene load but it exists ! HELP! 0 Answers
Game does not start in Xiaomi Redmi 4A 0 Answers