I have a particle system that is playing at the wrong time...
I have made 3 different types of particle effects I've named, death, respawn and beam out
When a player touches a pickup (Teleporter) they vanish and reappear in their place of origin. I made a particle system, beam out, as a transporter effect that starts up when the player reappears but instead of it happening when it appears at its origin, its happening when it disappears at the Teleporter pickup. But when I re-tag the Teleporter as "Enemy" it plays the death and rebirth particle effects perfectly.
All the others work as they are supposed to and the code used is identical for all 3 (with appropriate naming changes).
public GameObject BeamOut; private Vector3 spawn;
void Start (){
spawn = transform.position;
}
void OnCollisionEnter(Collision other)
{
if (other.gameObject.CompareTag ("Teleporter"))
{
Instantiate (BeamOut, transform.position, Quaternion.identity); //method to create an instance of an object at a position in the world
transform.position = spawn;
}
}
The enemy pickup and teleporter pickup are identical, what can I be doing wrong? Any suggestions?
Answer by kidne · Sep 12, 2016 at 04:09 PM
I don't fully understand what you're asking but if you want the object to instantiate at 'spawn' you should move the "transform.position = spawn;" line to occur before you instantiate.
holy shit it worked on the test file....I bow to your superior intelligence
I wanted the particle effect to appear when the player appeared at their start point
now i need to figure out how to get it to work when the player moves to a specific respawn point
thank you for the help :)