Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Not sure here (I'm not a Unity person), but it just looks like you're walking up the scene graph.
-
@Vake93 I did... to show it.
Every gameObject in Unity can access itself or its transform, and every transform can access itself or its gameObject, so you can chain them together forever -
@RememberMe Nope, you walk up the scene graph by calling transform.parent.
gameObject.gameObject.gameObject is "just access myself again, and again, and again" -
I see, thanks.
Is there any particular reason why a GameObject references itself?
I can get how weapon.transform.gameObject.transform... is a thing, because it (sort of?) makes sense for a transform to contain a reference to its GameObject (at least it's not outlandishly weird)
But why would a GameObject need that? -
@RememberMe it doesn't, but since everything in Unity extends the MonoBehaviour God object, shit like this happens.
That's why they're thinking of actually cutting this God object into separate parts in future versions
Related Rants
One of the amazing things you can do with Unity.
Seems legit.
rant
unity
hmm