Script properties don't transfer for instanciated object
Options
Bugfixr
✭
in Photon Bolt
I've got an object that I instantiate at runtime that has some script properties. I've noticed that those properties don't make it to the client. Here's some example code:
var item = Resources.Load("SomeItem") var s = item.GetComponent<MyScript>(); s.someValue = 10; BoltNetwork.Instantiate(item);If I check someValue on the server, it's set to 10. If I check it on the client, it's 0. Is there a way to get those assignments to transfer to the client during instantiation?
0
Best Answers
-
You can use a token when instantiating https://doc.photonengine.com/en-us/bolt/current/in-depth/protocol-tokens5
-
Bolt doesn't automatically sync over arbitrary fields or properties magically. I would suggest reading the tutorials and understand how state and state properties work. Tokens can be used for this as well, but in most cases you should use state properties.
5
Answers
-
You can use a token when instantiating https://doc.photonengine.com/en-us/bolt/current/in-depth/protocol-tokens5
-
Bolt doesn't automatically sync over arbitrary fields or properties magically. I would suggest reading the tutorials and understand how state and state properties work. Tokens can be used for this as well, but in most cases you should use state properties.
5