hey need help,how to teleport to where I want? for example like this,
use (Convert.ToInt32(this.inputLine.Remove(0, 3))??? how? please help me
hey need help,how to teleport to where I want? for example like this,
use (Convert.ToInt32(this.inputLine.Remove(0, 3))??? how? please help me
Try something like this :
if (this.inputLine.StartsWith("/teleport"))
{
String[] array = this.inputLine.Split(' ');
Vector3 position = Vector3.zero ;
double x ;
double y ;
double z ;
if (Double.TryParse(array[1], out x))
position.x = (float) x ;
else
Debug.LogError("Error with x " + array[1] ) ;
if (Double.TryParse(array[2], out y))
position.y = (float) y ;
else
Debug.LogError("Error with y " + array[2] ) ;
if (Double.TryParse(array[3], out z))
position.z = (float) z ;
else
Debug.LogError("Error with z " + array[3]) ;
transform.position = position ;
}