Hey. I want to start modding games but I quickly found out that I need to learn how to control everything without the editor, so I wanted to test some things and one of the things I wanted to do is to attach a movement script to the player via script but the script I wrote isnt working. here it is:
public float speed;
public GameObject Player;
void Start()
{
Player = GameObject.FindWithTag("Player"); //trying to find the player via tags
}
void Update()
{
//movement
Vector3 movement = new Vector3(Input.GetAxis("Horizontal"), 0f, 0f);
Player.transform.position = movement * Time.deltaTime * speed;
//printing the player current position to the console
Debug.Log(Player.transform.position.x);
Debug.Log(Player.transform.position.z);
Debug.Log(Player.transform.position.y);
}
}
any ideas?