Merged
Conversation
…on and improve lifetime management
…nt and AddSingleton methods
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the Reflex DI container integration for UniState, resolving GitHub issues #95 and #99. It refactors the existing experimental Reflex support to be production-ready (removing the experimental disclaimer from the README) and adds comprehensive test coverage mirroring what already existed for Zenject and VContainer.
Changes:
- Core extension refactoring:
ReflexBuildExtensions.csis overhauled soAddState(Type)now registers a state against all its interfaces and itself (via a newGetStateContractshelper), and state machine registration is unified through a customReflexStateMachineResolverthat handles both transient and singleton lifetimes with proper disposable tracking. - Full test suite: Eight new Reflex test classes are added (GoTo, GoBack, GoBackTo, Execution, BehaviorAttribute, History, Recovery, SubState), each backed by the new
ReflexTestsBasehelper class, matching coverage provided for Zenject and VContainer. - README update: Removes the "experimental" warning, adds a documentation note explaining the single- vs two-parameter
AddState/AddSingletonStateoverloads, and updates the code example to use an abstract base class instead of an interface in the two-parameter overload (reflecting the actual new intended use case).
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
README.md |
Removes experimental disclaimer; adds documentation for new AddState behavior and corrects the two-parameter overload example |
Assets/UniStateTests/PlayMode/UniStateTests.PlayMode.asmdef |
Adds Reflex assembly reference to the PlayMode test assembly |
Assets/UniStateTests/Common/TestFixture/ReflexTestsBase.cs |
New base class for all Reflex tests; manages container setup/teardown and provides RunAndVerify helper |
Assets/UniState/Runtime/Integrations/Reflex/ReflexBuildExtensions.cs |
Core refactoring: AddState now registers all interfaces, new ReflexStateMachineResolver handles lifetime and disposable management |
Assets/UniStateTests/PlayMode/GoToStateTests/GoToReflexTests.cs |
New Reflex GoTo state test |
Assets/UniStateTests/PlayMode/GoBackTests/GoBackReflexTests.cs |
New Reflex GoBack state test |
Assets/UniStateTests/PlayMode/GoBackToTests/GoBackToReflexTests.cs |
New Reflex GoBackTo state test |
Assets/UniStateTests/PlayMode/ExecutionTests/ExecutionReflexTests.cs |
New Reflex execution lifecycle test |
Assets/UniStateTests/PlayMode/BehaviorAttributeTests/BehaviorAttributeReflexTests.cs |
New Reflex behavior attribute test |
Assets/UniStateTests/PlayMode/HistoryTests/HistorySizeReflexTests.cs |
New Reflex history size test |
Assets/UniStateTests/PlayMode/RecoveryTransitionTests/RecoveryReflexTests.cs |
New Reflex recovery transition test |
Assets/UniStateTests/PlayMode/SubStateTests/SubStateReflexTests.cs |
New Reflex sub-state test |
.meta files |
Unity asset tracking metadata for all new files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Complete full support of Reflex DI container
Resolves #99
Resolves #95