I want to ask is that possible to teleport in a area to another area by using button.
Example
I set a button which is keyboard E, when i press E in a area it will teleport me to another area.
this is my code.
private Transform player;
void Awake()
{
player = GameObject.FindGameObjectWithTag ("Player").transform;
}
void Update()
{
if (Input.GetKeyDown (KeyCode.E) )
{
player.position = warp1.position;
}
}
this code giving me when i press E it direct teleport me to other area even no in the area that i want.