Just got back into unity, how would i make its so that an enemy teleports next to me (like slender man). I want him to start teleportation after a click on a object, and teleport more the more objects I get. Thanks for anyone who helps
You can use an empty game object and place it as the player’s child behind the player as a spawn point or teleport point.
Basically you always teleport things. Every movement is, technically speaking, a teleportation. Usually we just want to make it seem smooth. So in this case, instead of doing frequent small changes, you do a single large change, ie ‘teleporting’. The only thing that’s different from regular movement is the condition and the target location.
The condition, as you said, would have to do with the amount of items collected, and probably a timer (which may be affected by the item count as well). When that timer runs out, teleport once and reset the timer. That’s just one example for how to approach it and you can obviously chose a condition you like.
As for the target location… that heavily depends on the game. You could go with mgrekts’ solution and have a fixed (or small group of) spawn points as children of the player. You could also just place predefined spawnpoints in the world and randomly chose the closest one that’s at least 1m away from the player. Or you can take the player position and add some random values to it to determine a completely random spawn position around, or behind, the player.
As you can see, this is a rather broad question so most of it is actually up to game design choices. If you have a more specific question about teleporting an object we can give more specific advice. Hope this helps