Easy question for PhotonView and Observed Components

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

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).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Easy question for PhotonView and Observed Components

soiledninja
2015-11-25 03:38:37

I've been looking for a simple explanation for some of the fundamentals for photon but haven't been able to find much. I followed the Marco Polo tutorial and even got PUN working in my own game but I'm unclear on proper usage of PhotonView and Observed Components.

For PhotonView do you just need one per scene (the tutorial isn't clear on that) or are there instances when more than one is appropriate?

Also for the observed components portion of PhotonView, am I supposed to populate that with every possible gameobject that needs to be communicated across the network (e.g. Players, Enemies, Items for pick up, breakable objects, etc)? If so are people doing this via script since that could become quite arduous after a while?

Comments

Rigs
2015-11-25 13:28:50

hmmm Objects already created int he scene do not need a photon view as they will be loaded by everyone anyway. But if you wanted them to move you would need a photon view.

say if it was a player hitting a box or something, you could send an RPC to say this box was just hit, tell everyone that it was.
hope this helps or maybe i misunderstood your question :)

TreeFortress
2015-11-25 20:00:19

As I understand it (could be wrong!) PhotonView at it's most basic level, allows you to send RPC calls for a given object, and gives you a network Id you can use to talk about that object.

A PhotonView Observer component, can be used anytime you need to serialize some state of the object, each frame. This can be for movement, player inputs, health etc. By default it will update every 100ms, but you can increase/decrease that if you need.

soiledninja
2015-11-26 02:23:45

Thanks for the responses, that helps.

Back to top