I need help tweaking my telepoting code!!! Please Help!!! Description is long but necessary.
Okay, so I have this code:
var other : GameObject;
var destination : Transform;
function Update () {
if (Input.GetKeyDown (KeyCode.G)) {
other.transform.position = destination.position;
}
}
Now, this code only half accomplishes what I want. When you use this code, it will let you choose the Destination, and the Other (Player). So when I press "G", the player moves to the destination.
Since I have crafted this code, I have modified my level layout. Now, all I need for my code to do is this:
(logical statement)
When Player presses "G" Player moves up "X" amount of Units.
Your answer
![](https://koobas.hobune.stream/wayback/20220612063917im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to detect input in InputField in unity when used in android? 0 Answers
Unity's / C# limitations with high number of object instances? 1 Answer
How to isolate my character in the assets so I can attach the camera to script (PUN ONLINE) 0 Answers
System.IO.File' does not contain a definition for `ReadAllBytes' 2 Answers
Best way to pick up objects in unity? 2 Answers