- Home /
How to stop the parents script affecting one of the children?
I have a death script on my parent object so that when they are touched by a "death" tagged object the scene will restart. However children object attached to this parent will also restart the scene when touched by the "death" tagged object. How do I prevent this death script when the children are collided with.
Answer by Llama_w_2Ls · Jan 29, 2021 at 10:59 AM
You could change the tag of your parent object to 'Parent', and place the collision script on the enemy, instead of the player. This way, the enemy is detecting whether or not they hit an object tagged as 'Parent', and this shouldn't be a problem if you have children colliders, as they won't be tagged as 'Parent'. @FezzaOrFez
That should work as long as you compare tha tag of the collider. How does your code look like? You may want to update your question and include the relevant code. If you include code, make sure you mark it as code by selecting all code and press the 101/010 button.
Your answer

Follow this Question
Related Questions
How can I animate a death sequence for the FPS controller? 1 Answer
Why isn't my Death Script Working? 3 Answers
Death and animations 1 Answer
Count Deaths 2 Answers
Cant figure out a script for dying 3 Answers