question

wjurica avatar image
wjurica asked

How to use PlayStream events in Automation->Rules?

I would like to make a Rule that evaluates client_focus_change and checks whether FocusState is true or false. Would I select Custom Event and the enter com.playfab.events.client_focus_change? Then how do I drill down into the payload to check the FocusState?

PlayStream
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andy avatar image
Andy answered

Client_focus_change is a newer style of event we call an entity event. The unfortunate side effect of that today is it's not available to trigger actions. Triggered actions are currently limited to the classic player events. We're hard at work extending more systems to work with the newer style of event, so be on the lookout.

For now, you could consider taking a look at the client_focus_change event, hooking the same Unity engine event, and sending a player event via WritePlayerEvent. That event would then be available to trigger an action.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

wjurica avatar image wjurica commented ·

Thanks for the answer, Andy.

Which approach would be better or worse: calling a CloudScript function when OnApplicationFocus is called or sending an custom PlayFab event when OnApplicationFocus is called then making a rule/event to react to that?

0 Likes 0 ·
Andy avatar image Andy ♦♦ wjurica commented ·

That's an interesting decision. If your rule is just going to call cloud script, you're better off cutting out the middle man and just invoking the cloud script directly. Do be careful about how often you're doing so, though. I wouldn't want you to start seeing throttling based on client call rate.

If your rule doesn't depend on cloud script, though, I'd recommend the event.

0 Likes 0 ·
Johan de Bruin avatar image
Johan de Bruin answered

Is this event still not available via trigger actions? I've been trying to setup but seems like is not being called.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.