feat(costume): align state-driven costume flow#306
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".
| public static bool TryGetActorAdapter(Flow flow, ValueInput actorInput, out ActorPresenterAdapter adapter) | ||
| { | ||
| adapter = null; | ||
|
|
||
| GameObject actorObject = null; | ||
| if (actorInput != null && flow != null) | ||
| { | ||
| actorObject = flow.GetValue<GameObject>(actorInput); | ||
| } |
There was a problem hiding this comment.
Guard actor port before calling GetValue
All three rewritten costume units declare a new actor input (ValueInput<GameObject>("actor") in CostumeUnits.cs lines 53/114/163) so that the caller can optionally pass a GameObject or let the unit fall back to the runner’s cached adapter. However ScratchUnitUtil.TryGetActorAdapter now unconditionally executes flow.GetValue<GameObject>(actorInput) (lines 165‑173) without checking flow.HasValue or providing a default value. In Visual Scripting an unconnected ValueInput without a default throws InvalidOperationException: Value of ‘actor’ could not be retrieved…, so any existing graphs that leave the new port empty (which is the default because the previous units had no actor input) now crash before the fallback path runs. As a result all costume blocks stop working until every graph is rewired. Please either give the port a default of null or guard the GetValue call with flow.HasValue(actorInput) so the automatic adapter resolution still runs when the port is unused.
Useful? React with 👍 / 👎.
Summary
Testing
Codex Task