Unity-Technologies / multiplayer-community-contributions

Community contributions to Unity Multiplayer Networking products and services.
MIT License
429 stars 161 forks source link

Suggest new transform parent on instantiation #113

Closed sbtoonz closed 2 years ago

sbtoonz commented 2 years ago

Would leave hierarchy view much cleaner and organized in my scene view to attach the instantiated prefabs to the transform of the networkobject pool

unity-cla-assistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.

LukeStampfli commented 2 years ago

I don't think (but could be wrong) that this solution works. I don't think that this will cause the spawned objects to be parented under the pool because GetNetworkObjectInternal will reset their parent again to null.

As for cleaning up the hiearchy if this is wanted I'd suggest to add your code in this PR but remove the parenting uses in GetNetworkObjectInternal and ReturnNetworkObject that way all the objects will always be parented under the pool. But I don't think that's something we'd want for this implementation here.