Async Instantiation? Problems that could arise?
Options
Has anyone done it? I'm currently experimenting with asynchronous instantiation based on Unity's Addressables System. Basic instantiations work fine, but there is still a lot of stuff that I have to implement (like, deleting cached events once objects are destroyed and stuff like that).
I'm worried about scenarios like these:
Client A
- Sends async instantiation signal to other clients
- Async instantiates object in 200 ms
- Calls RPC on the object we just instantiated
Client B
- Receives async instantiation signal
- Async instantiantes object in 600 ms because of slow drive
- Before finishing instantiating the object, receive RPC signal and fail
Could that possibly happen? or does Photon have something to take care of RPC for objects that are not ready?. I'm asking so I know if I should even bother continuing working with this asynchronous instantiation mechanism.
I'm worried about scenarios like these:
Client A
- Sends async instantiation signal to other clients
- Async instantiates object in 200 ms
- Calls RPC on the object we just instantiated
Client B
- Receives async instantiation signal
- Async instantiantes object in 600 ms because of slow drive
- Before finishing instantiating the object, receive RPC signal and fail
Could that possibly happen? or does Photon have something to take care of RPC for objects that are not ready?. I'm asking so I know if I should even bother continuing working with this asynchronous instantiation mechanism.
1
Comments
-
This is a question I would like to get an answer on as well.0
-
Bump0
-
Hi @davidrochin, @creimschussel,
Thank you for choosing Photon!
At some point we're considering out-of-the-box support for addressables but we're not there yet.
PhotonNetwork.Instantiate and RPCs are both RaiseEvent requests sent reliably, so even if you use UDP they should arrive in the same order they are sent.
You could pause incoming messages' processing while doing asynchronous instantiation locally using PhotonNetwork.IsMessageQueueRunning = false.
The problem is similar to loading scenes using Photon which happens asynchronously.
Read more here.So to sum up, this should work but we did not test it and I want to know if it works for you.
1