- Home /
Question by
MultiFlipman · May 30, 2013 at 07:31 AM ·
guispawnclickship
Player Fast Travels
How would one have a GUI Button, when clicked, spawn the player to a location?
Comment
Answer by robertbu · May 30, 2013 at 07:56 AM
Set v3Pos in the inspector to the new location:
#pragma strict
var v3Pos = Vector3(2.0, 0.0, -1.0);
function OnGUI() {
if (GUI.Button(Rect(200,200, 150, 50), "Teleport")) {
transform.position = v3Pos;
}
}
Your answer
Follow this Question
Related Questions
Cube Counter 1 Answer
Get Mouse Position GUI 3 Answers
click on GUI button goes through to a collider... 0 Answers
Multiplayer click and spawn 1 Answer