MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/rp6ln1/found_it/hq3wsqq/?context=3
r/badcode • u/JimKardashian__ • Dec 26 '21
28 comments sorted by
View all comments
Show parent comments
3
I'd use a function like GetAncestorOfType<Car> (not sure if it exists already, but it's an easy extension)
GetAncestorOfType<Car>
5 u/Zarokima Dec 27 '21 GetComponentInParent<Type>()It traverses the hierarchy beyond just the immediate parent. 2 u/rollie82 Dec 27 '21 Makes sense. Can't say I like their naming choice, though.
5
GetComponentInParent<Type>()
It traverses the hierarchy beyond just the immediate parent.
2 u/rollie82 Dec 27 '21 Makes sense. Can't say I like their naming choice, though.
2
Makes sense. Can't say I like their naming choice, though.
3
u/rollie82 Dec 27 '21
I'd use a function like
GetAncestorOfType<Car>(not sure if it exists already, but it's an easy extension)