Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Child Object OnCollisionEnter Effecting it's Parent + Sibling Objects

$
0
0
Hey guys thanks for reading. I have a wall, the wall is made up of bricks. All these bricks are stored in a "Wall" empty gameObject . When my bullet hit's a brick, I would like only the brick it collided with to be setActive(false); however for some reason the parent of this object is also being setActive(false); along with all other brick sibling objects. This does not happen when it is not a child of the "Wall" gameObject, but it is not possible for me to not have this parent, for other reasons in the game. I have tried using: void OnCollisionEnter(Collision other){ other.gameObject.transform.parent = null; } but this also did not work. I am COMPLETELY stumped :(. Any ideas? Here is my code. void OnCollisionEnter(Collision other){ if(other.collider.transform.tag == "Cube"){ other.gameObject.SetActive(false); } }

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>