Does photon view works when calling it from a prefabs folder in the halfway?
Hi guys, I am creating a 3D pen in my VR multiplayer game, and I want all the players inside the room to see the pen trail simultaneously. And basically how my 3D pen works: I just instantiate the pen trail when I activate it, so the pen trail is a prefab instead of putting it inside the scene. And I have tried this by adding photon view and photon transform view to the pen trail prefabs, meanwhile send the "Drawing" method script to all the players inside the room through RPC, but it doesn't work from other player's view, here's my script:
Void Start Trail(): Instantiate the trail prefabs when activating the 3D pen
Void End Trail(): Stop calling the prefabs once deactivating the 3D pen
[PunRPC]: Basically, I used this to send the drawing messages to all the players inside the room
And this is how the Photon View and Photon Transform View look like while the pen trail prefab is called inside the scene.
Let me know if you guys have any ideas for this situation above, thanks in advance and really appreciate that you read the question until here, wish you all a wonderful day ahead!
Using an RPC to activate some effect should work. You must use PhotonNetwork.Instantiate to get a networked object, which would be the "target" of the RPC.
You probably want to synchronize more points for the drawing. With 10 updates per second (for position updates), the others will not see a good representation of what you draw. So .. you could run a script on the drawing client and collect the positions more frequently, prepare a Vector3 array and send this (for that, 10 updates/sec should be OK).0
Hi Tobias, thanks for your suggestion, but PhotonNetwork.Instantiate is only suitable for those messages which called once such as Player Prefabs or Enemy prefabs, mine is 3D pen trail, which means it needs to be like the normal Instantiate method which can spawn the trail and follow the transform.position, I have tried using PhotonNetwork.Instantiate(trail prefabs, Pen.transform.position, Pen.transform.rotation), but it doesn't move and rotate like the normal instantiate method, I am wondering if it's because of the difference between Photon Network.Instantiate method and normal Instantiate method, do you have any idea? Here's my script, looking forward to your reply, thank you!0
You misunderstood: Instantiate would be used to instantiate the drawing. All the positions of the drawing would not be sent with the Instantiate but via OnPhotonSerializeView or RaiseEvent.0