Addition of OnInstantiatePrefab #221
Closed
phoxman1982
started this conversation in
Feature Request
Replies: 1 comment
-
This works for owners and non-owners. If you have ShareIds off however clients will not know who owns other objects, and this will not work in that situation. See ServerManager > ShareIds. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was going through the API documentation trying to figure out how to make it so that my client can perform an action when the server tells it to spawn a prefab and have come up empty and thought this was a bit odd as there should be a way to do this.
What I am trying to accomplish is check the incoming NetworkObject and see if one is already in the scene, since the default behaviour is to clone the prefab it just adds additional clones and this is unwanted in my current situation. For now I am having to use a Dictionary on the server end to keep track of what I send to each client and check to see if I have sent the object already which is fine but I thought this could be a useful feature for not only this scenario but I'm sure there could be many other situations this would come in handy.
I did however notice I could do like this but then realised that the client has to own the object for this to work, perhaps maybe just add a argument or something to permit a non-owner to receive the action if the server sends an arguement with Spawn(), that could be another way to go about it, this way the server needs to tell the given client it is OK to trigger OnObjectAdded without being the owner of said object.
Server
Client
Beta Was this translation helpful? Give feedback.
All reactions