Unable to use tags on children of a gameobject.
I'm pretty sure the question has been asked all over the forum. I Just don't seem to understand on how to implement it on my code (c#).
i have a gameobject player. The object hase multiple sprites with colours like red , green etc. The children are sprites tagged with the colour of the sprite. Can somebody finish of the code:
if (gameObject.tag == "red" && .... ){
....
if (hit.gameObject.tag == "playergreen")
{
....
}
}
So : playergreen are the green sprites of the player.
I need collison detection of the "red" gameobjects on the green objects which are a child of player.
when you collide you receive a Collision struct with contacts. each contact knows the colliders that bumped into each other. use those to distinguish between parts of a body.
Your answer
Follow this Question
Related Questions
How to put ".transform" after "GameObject.FindGameObjectsWithTag()" 1 Answer
Trying to play a different using animation based on type of gameobject. 0 Answers
After Rotating a Prefab, Transform.Position of children is inaccurate 1 Answer
Issues with randomised objectpool, tag setting and re-setting, general noob issues 0 Answers
Spawning a number of enemies while condition is true 0 Answers