if (type==Type.Bomb){
Collider[] DestroyedObjects = Physics.OverlapSphere(this.transform.position,1.5f);
Instantiate(BombExplosion, this.transform.position, BombExplosion.transform.rotation);
foreach(Collider Blocks in DestroyedObjects){
if(Blocks.tag == "Block"){
Destroy(Blocks.gameObject);}
if(Blocks == Bomb){
Instantiate(BombExplosion, Blocks.gameObject.transform.position, BombExplosion.transform.rotation);
Destroy(Blocks.gameObject);}}
Destroy(gameObject);}
Bomb → Is my prefab object.
BombExplosion → Is an explosion prefab.
First Instantiate creates BombExplosion at position of Type.Bomb as it needs to. Second Instantiate, Does NOTHING.
How can I make, if Bomb is in radius… Instantiate BombExplosion at position of Bomb, rotation to be same as prefab BombExplosion.