I need a script that when any object touches my “teleporter” they are teleported to another location. I’m using photon and the players are made on runtime. (In other words the players don’t have there own gameobject, when they start the game the object is made.)
If Loius’ answer doesn’t work for you, make sure the object you’re trying to teleport has a PhotonView and a PhotonTransformView attached to it. And make sure you add the PhotonTransformView to the PhotonView’s Observed Components list.
If that doesn’t work, or you also have to sync your Rigidbody2D, you can add a PhotonRigidbody2DView to your object in the same way.
If it still doesn’t work, try replacing gameObject.transform.position = targetPosition; with a call to teleportObject():
You might also be able to get away with just setting Rigidbody2D.isKinematic = true; before setting the position and then just setting it back with Rigidbody2D.isKinematic = false; at the end, but I haven’t tested it.