- Home /
This post is currently awaiting moderation. If you believe this to be in error, contact a system administrator.
Question by
mzeman2203 · Apr 27, 2021 at 07:20 PM ·
c#raycasthit
How to get children objects from parent name
I am using this piece of code to see if the user is hovering over the object by the name of "townhall"
hit.collider.gameObject.name == "townhall"
But, what I want is to see if the user is hovering over the children of the object by the name of "townhall"
Comment
Best Answer
Answer by Hellium · Apr 27, 2021 at 07:28 PM
if(hit.collider.transform.parent != null && hit.collider.transform.parent.name == "townhall")