So I have a pretty sloppy but seemingly innocent script. When clicking on a tagged object the player is teleported to the position of the tagged object, not before logging his position (which I can see in the editor and seems accurate) it then without an issue moves the player using a simple transform.position = whatever. It works as intended until I right click and try to escape, in which I have no clue why it doesn't work. The debug message plays, telling me I fufilled the condition, every other variable in this if works as desired, except the player is not moved. I have not a clue why. In this screenshot I have a test in which I try to move it to an arbitrary vector to see if that would change anything. It didn't. If anyone knows why I could be struggling here please let me know.
#Transform position works and then stops working to move the same object in the same script
1 messages · Page 1 of 1 (latest)
you can try to use the debugger and place a breakpoint to step through code execution line by line
I will try that in a bit, but I have made a mild tweak, I created an independent key that teleports the player to a random position just for testing, I mashed it while considered "hiding" and teleported, I changed the normal exit code to be "mashable" and randomly it works within a few attempts?
[]cb
Use codeblocks to send code in a message!
To make a codeblock, surround your code with ``` (3 backticks. Click here to see where the key is)
To use syntax highlighting, add the file extension of the language you wish to highlight (cs for C#, cpp for C++)
For example:
```cs
Console.WriteLine("Hello World");
```
Produces:
Console.WriteLine("Hello World");
To send lengthy code, paste it into https://paste.myst.rs/ and send the link of the paste into chat.