#Guys how do I detect collisions on an Instanciated Object?

1 messages · Page 1 of 1 (latest)

mystic sluice
#

So my script creates a basic sphere and I want to detect when it collides something so I can destroy it.
The problem is how do I do this?
Can I do it from the script that creates the sphere?

ashen junco
ashen junco
#

putting it on the projectile itself would be simplest

mystic sluice
ashen junco
#

e.g.

[SerializeField] Projectile projectilePrefab;

void Shoot() {
  Projectile projectileInstance = Instantiate(projectilePrefab);
  projectileInstance.Init(/*whatever data you want to pass to the projectile*/);
}```
#

just make a function with whatever inrformation you want to pass as parameters, and call it