feat: add stop control units and thread manager#308
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| private ControlOutput OnEnter(Flow flow) | ||
| { | ||
| if (ScratchUnitUtil.TryGetThreadContext(flow, out _, out var threadId)) | ||
| { | ||
| FUnityScriptThreadManager.Instance.StopThread(threadId); |
There was a problem hiding this comment.
Stop control units never stop anything
Both StopThisScriptUnit and StopOtherScriptsInSpriteUnit rely on ScratchUnitUtil.TryGetThreadContext (and ultimately FUnityScriptThreadManager) to find the current thread, but the commit never stores that context anywhere. The accompanying helper ScratchUnitUtil.SetThreadContext and FUnityScriptThreadManager.RegisterThread that would supply FUnity_ActorId/FUnity_ThreadId are never called anywhere in the repo, so the flow variables they read are never defined and the thread manager’s dictionary always stays empty. As a result the new Stop blocks are no-ops: TryGetThreadContext always returns false, so StopThread/StopThreadsOfActorExcept are never reached, and StopAllUnit also has nothing to stop. Please hook the runner/coroutine startup to register each script with the manager and call SetThreadContext so these units can actually stop scripts.
Useful? React with 👍 / 👎.
Summary
Testing
Codex Task