playMaker

Author Topic: Variable network sync + Template  (Read 4111 times)

bodsey

  • Playmaker Newbie
  • *
  • Posts: 7
Variable network sync + Template
« on: September 17, 2015, 09:12:09 AM »
Hello there,

I'm getting into Photon for Playmaker and I've just discovered how you can use Template properly, which is great.

Anyway, I've got an issue. When I use a Template and within this template there is a variable with Network Sync, Unity crashes when I try to click the variable in the Playmaker inspector, and moreover the variable actually doesn't update during the online play.

Any workaround ?

Thanks a lot !

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Variable network sync + Template
« Reply #1 on: September 18, 2015, 03:52:01 PM »
Hi,

 uhm, I never tried this. Let me repro this and raise a case.

 Bye,

 Jean

human890209

  • Junior Playmaker
  • **
  • Posts: 62
Re: Variable network sync + Template
« Reply #2 on: February 03, 2017, 09:06:20 AM »
Today Feb 3, 2017
I found that if I use a FSM which Uses Template, It's Variables can not be Synced by PUN. Then I make it a normal FSM just by pasting the Template, Variables Sync works fine!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Variable network sync + Template
« Reply #3 on: February 06, 2017, 12:34:40 AM »
Hi,

 Uhm, yes, that's going to be a problem, because if the variable doesn't exists at all time during the life of GameObject, then it's tricky.

I don't think there is a possibility to implement this, I'll check with the Photon Guys, maybe there is a trick, I'll get back to you.

 
Bye,

 Jean

human890209

  • Junior Playmaker
  • **
  • Posts: 62
Re: Variable network sync + Template
« Reply #4 on: February 06, 2017, 09:06:51 AM »
Hi, Jean.
I don't understand the saying that "if the variable doesn't exist at all time during the life of GameObject".
 Do you mean that If a FSM use Template It is generated during Run-Time?
What I mean is not the FSM run by RUN FSM ACTION.
I'm using the way my pic shows below.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Variable network sync + Template
« Reply #5 on: February 06, 2017, 10:27:49 AM »
Hi,

 yes, so there is no guarantee that both fsm will be in the same state where the template is ran, so the photonView would need to allocate space for all templates when possibly none would be necessary, this is very bad for performances and bandwidth.

 I'll see what I can do, but this is a major change and will be set with a big warning as it will impact performances.

what variable is in this template that you need to sync over the network? can you give more details about the context and usage, maybe I can propose a better solution?

Bye,

 Jean

human890209

  • Junior Playmaker
  • **
  • Posts: 62
Re: Variable network sync + Template
« Reply #6 on: February 06, 2017, 08:44:17 PM »
Hi,
If it is a big bug that can't be fixed easily, I think I can find a way to walk around. I can make a None-Template "DataSync" FSM doing the Variables Sync Job and let the Original Template FSM set/get variables to/from it.

I think what should be done is Making a Warning Tag to inform the user that a Template FSM's Variable Can't Be Sync by PUN. :)
(Is it same for UNet?)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Variable network sync + Template
« Reply #7 on: February 07, 2017, 12:44:12 AM »
Hi,

Yes, you are going in the right direction, you should have only one Fsm with ALL the synched variables you need, and other fsm simply use GetFsm and SetFsm to read and write to it. This will be a lot easier in the long run.

Bye,

 Jean

human890209

  • Junior Playmaker
  • **
  • Posts: 62
Re: Variable network sync + Template
« Reply #8 on: February 07, 2017, 08:01:40 PM »
Yes, I already doing sync like that. But I make every FSM a Template to keep everything easy to manage by Project Folder. ;D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Variable network sync + Template
« Reply #9 on: February 08, 2017, 12:24:21 AM »
Hi,

 I see, you are using a template for the FSM, not within the fsm inside a State.

 That's a different matter, sorry, I realize now there is the need for this in this case.

 I'll see what I can do, Please bump next week if I haven't had time since then.

 Bye,

 Jean