Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: justifun on May 20, 2022, 03:17:29 AM

Title: Custom Action Coding Question
Post by: justifun on May 20, 2022, 03:17:29 AM
I'm writing a custom action to check the bool value of a object right after it was instantiated on the network. (FishNet in this case).

The bool is for whether or not the game object is Owned by the current local player or not.

When it first spawns, that value is "False" for 1 frame or something, then becomes "True" if its true for every frame after that. 

I guess it takes a frame or so to go from its default False to True

OnEnter() always picks it up as "False" but if i add an "Every Frame" check to my action it will become "True" next frame.

How do I get OnEnter() to either way a sec or deal with the new object needing a second to set its local bool?
Title: Re: Custom Action Coding Question
Post by: Fat Pug Studio on May 20, 2022, 04:46:07 AM
There's a lot of racing conditions when using Playmaker. If you're writing a custom action, you can always make on enable to wait for invoke another method with a small delay. That another method will have get bool.
Title: Re: Custom Action Coding Question
Post by: djaydino on May 20, 2022, 09:38:58 AM
Hi.
you can setup a coroutine or a await

for await you might need to set a #pragma to prevent a warning

and wait a frame, or check for some initiate completed