NetworkInstantiate prefab with multiple Views
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
NetworkInstantiate prefab with multiple Views
PJB
2020-09-09 17:12:23
Apologies if this is a dupe, I couldn't find anything similar:
I'm trying to instantiate a player prefab to which I recently added two additional children with PhotonViews, and its causing an exception (index out of range) in PhotonNetwork:NetworkInstantiate.
Problem is that if localInstantiate
remains false, then parameters.viewIDs
is not reassigned with the correct length from the photonViews array.
Does anyone know if I might have misconfigured something, or if this might be a bug?
Comments
Nested photon views are not officially supported, because things like what you are trying to do there will break them. Nesting handling has been added recently - but it is not completely supported. To pull off instantiating like that, you will need to instantiate them individually, and then nest them manually currently.
I will look into making what you are trying to do possible in future releases.
Is there a reason you have nested PVs though? Usually when people do that, it is a bad practice which can be avoided.
One use case would be if an object fractures into parts later. If the object does not break apart into separate entities, a single root view usually is preferable.
This is in my user avatar construct. I'm doing a mixed-reality app, so my avatar consists of a head transform and two hand transforms, each of which are being synced.
I actually overcame the problem I was having and now I can't remember how - the only thing I can think of at the moment is that I may not have set the two PhotonViews in the children as Fixed ownership at first.
Back to top