Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition in coil activation #9

Open
arthurkehrwald opened this issue Nov 26, 2024 · 1 comment
Open

Race condition in coil activation #9

arthurkehrwald opened this issue Nov 26, 2024 · 1 comment

Comments

@arthurkehrwald
Copy link
Contributor

Problem

This script has no effect:
image
This script causes the ball to spawn:
image

Cause

What should happen is:

  1. Player.Start is called by Unity
  2. CoilPlayer.OnStart is called
  3. CoilPlayer.HandleCoilEvent is added as a callback to IGameLogicEngine.OnCoilChanged
  4. The table script starts running and the "Pulse Coil" node is executed
  5. The ball spawns

The problem is that the table script starts running before Player.Start is called and nothing happens because CoilPlayer.HandleCoilEvent does not yet observe IGameLogicEngine.OnCoilChanged. This might be non-deterministic as well because the order of in which Start is called on MonoBehaviours is. Not sure how it is in Visual Scripting.

@freezy
Copy link
Member

freezy commented Nov 26, 2024

Hmm, interesting.. What I could think of would be to create a custom event that is triggered properly on start, when everything has been initialized?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants