Question by
markolosole · Jan 11, 2019 at 03:23 PM ·
instantiateprefabclones
instantiate within function without clones
So, I have made a pickup object as a power-up so the player can triple jump. I have attached a script to it and when the player picks it up then it is destroyed and it instantiates an explosion. The explosion keeps replaying as a clone that has been created in the editor. Of course, this is not desirable. How can I stop it? The instantiate is within a function. The whole thing does not use an Update()
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
Pickup(other);
}
}
void Pickup(Collider Player)
{
Instantiate(pickupEffect, transform.position, transform.rotation);
Player.transform.localScale *= multiplier;
Movement jumps = Player.GetComponent<Movement>();
jumps.numberOfJumps = 3;
Destroy(gameObject);
}
Comment