Skip to content

feat(costume): align state-driven costume flow#306

Merged
oco777 merged 1 commit intomainfrom
codex/improve-costume-switching-logic-and-docs
Nov 15, 2025
Merged

feat(costume): align state-driven costume flow#306
oco777 merged 1 commit intomainfrom
codex/improve-costume-switching-logic-and-docs

Conversation

@oco777
Copy link
Copy Markdown
Owner

@oco777 oco777 commented Nov 15, 2025

Summary

  • add ActorState costume tracking utilities and update ActorPresenter to normalize and apply sprites through ActorView
  • expose costume APIs via ActorPresenterAdapter and rewrite Scratch costume units to resolve adapters with actor inputs
  • document costume handling across FUnityActorData, Scratch mode usage, VS mapping, and contributor guidelines

Testing

  • not run (not requested)

Codex Task

@oco777 oco777 merged commit 89fc39e into main Nov 15, 2025
3 checks passed
@oco777 oco777 deleted the codex/improve-costume-switching-logic-and-docs branch November 15, 2025 13:57
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +165 to +173
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);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant