Hi All
I’ve haven’t watched that solution yet but I’m working on the solo challenge. Specifically towers shooting the enemy ship with particles which works ok. I’m trying to use the same same instantiation method we used with the enemies in rail assault but I have 1 annoying issue.
I have a gameobject in the root of the scene called enemyDeathFX. This has a particle explosion and sound affect attached.
When a particle from the tower guns hit the enemy we do a ;
GameObject fx = Instantiate(enemyDeathFx, transform.position, Quaternion.identity);
Destroy(fx, 2.0f);
This allows for mutiple hits as we reduce the hitcounter for this enemy.
The issue I have is as the gameobject is a normal gameobject it ‘goes off’ as soon as I hit play before anything is fired at the enemy ship. This is because the enemyDeathFX is enabled in the inspector. Works ok after the initial explosion
I can disable it in the inspector but then it never actually does anything.
The rubbish ‘solution’ i’ve found is child enemyDeathFX to the enemy and do a enemyDeathFx.SetActive(true); The first time OnParticleCollision(GameObject other) is called for this enemy. Also disable in inspector.
Doesn’t feel right to me !