Skip to content

Refactor: Separate AutoInject from SetContainer build callback#856

Open
asdqwe02 wants to merge 1 commit into
hadashiA:masterfrom
asdqwe02:master
Open

Refactor: Separate AutoInject from SetContainer build callback#856
asdqwe02 wants to merge 1 commit into
hadashiA:masterfrom
asdqwe02:master

Conversation

@asdqwe02

@asdqwe02 asdqwe02 commented May 31, 2026

Copy link
Copy Markdown
  • Move RegisterBuildCallback(SetContainer) to start of InstallTo.
  • Separate AutoInjectAll from SetContainer and add to container build callback at the end of InstallTo

Currently, SetContainer is registered as a build callback before InstallTo is called and AutoInjectAll is call inside SetContainer, meaning user-defined container build callbacks will be called after MonoBehaviours are auto-injected via LifetimeScope.

This change separate AutoInjectAll from SetContainer and add builder.RegisterBuildCallback(AutoInjectAll) to the end of InstallTo, ensuring it is always the last registered build callback. As a result, when MonoBehaviours are auto-injected via LifetimeScope, all container build callbacks (including any registered by user installers) are guaranteed to have completed first.

Before: SetContainer (with AutoInjectAll) callback was registered before InstallTo, so it could be invoked before user-defined callbacks.
After: AutoInjectAll is separated from SetContainer, add AutoInjectAll as last container build callback so it runs after all other build callbacks have finished.

@vercel

vercel Bot commented May 31, 2026

Copy link
Copy Markdown

@asdqwe02 is attempting to deploy a commit to the hadashia's projects Team on Vercel.

A member of the Team first needs to authorize it.

@asdqwe02 asdqwe02 changed the title Refactor: change SetContainer build callback order Refactor: Separate AutoInject from SetContainer build callback Jun 12, 2026
…ll order

- change SetContainer build callback to the start of container build configuration
- separate AutoInjectAll method from SetContainer and set AutoInjectAll as the last container built callback
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

Successfully merging this pull request may close these issues.

1 participant