-
Notifications
You must be signed in to change notification settings - Fork 460
feat: AttachableBehaviour and ComponentController #3518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: AttachableBehaviour and ComponentController #3518
Conversation
…d-object-controller
…d-object-controller
Minor XML API fixes.
Simplified the nameof AttachableBehaviour.Detach to just Detach.
…d-object-controller
Refactoring the ComponentController to provide more flexibility as well as being able to have component entries that will apply the inverse of the current ComponentController's current state....which allows for switching between different sets of components depending upon the controller's state.
switching to a Light component as opposed to BoxCollider as BoxCollider requires the physics package and we are just testing the functionality of ComponentController and not specifically any one other type of component.
…d-object-controller
…d-object-controller
…d-object-controller
Using RPCs and synchronizing the property being set using NetworkBehaviour.OnSynchronize in order to assure order of operations when it comes to messages. Updated the ComponentController to be able to stagger state updates in the event this occurs (wip and I might remove this part and not allow changes to state until any pending state is finished).
Minor adjustment to the range for delays allow it to be zero. Fixing spelling issues.
Had to make some minor adjustments in order to assure that users could handle sending any last micro-second tasks on any spawned instances prior to them despawning. Added NetworkBehaviour.OnNetworkPreDespawn. Did a slight order of operations on NetworkManager.Shutdown internal in order to assure sending RPCs during despawn would still work. Minor adjustments to the new helper components associated with this PR.
…d-object-controller
…d-object-controller
|
Okay I just pushed a large docs commit, hear me out:
All in all, I think this is a really good body of doc to launch this feature with, and we can finesse it if/when we get user feedback about it. |
|
@jabbacakes Is this just the doc tool when building local or is this an issue we need to resolve? |
…d-object-controller
…d-object-controller
Applying modifications suggested by Emma.
…nentController.cs Co-authored-by: Emma <[email protected]>
…d-object-controller
…d-object-controller
Modifications from 1:1 PR review session with Emma. Removed some redundant logic. Re-organized a few areas for better readability. Renamed the `AttachableBehaviour.AttachableNode` to `AttachableBehaviour.InternalAttachableNode`. Removed the authority check within `AttachableNode.OnNetworkPreDespawn`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
Adding OnNetworkPreDespawn documentation. Adjusted the NetworkBehaviour documentation to include some best practices information.
…d-object-controller
|
Alrighty that's my review of your latest changes done @NoelStephensUnity Couple of mass changes again, because apparently I can't help myself:
Also re: the footer overlap issue, that's an oddity of the local docs build and doesn't recur on the live package sites, so wouldn't worry about it. |
…d-object-controller
|
thanks Noel, it looks like these components will alleviate a lot of unneeded complexity. With the mech |
For the attachable, you still need to have another network prefab that would have a nested child with the For now, you can look at the updated documentation to see more about this. But both In regards to |

Depends on
This PR depends upon the fix for the
SendTo.NotMefix in #3551.AttachableBehaviour and Support Components
The purpose of this PR (feat) is to address the complexity of "picking up" or "dropping" an item in the world which can become complex when using the traditional
NetworkObjectparenting pattern. In this PR there are three primary components added to help reduce this complexity:AttachableBehaviour: Provides "out of the box" support for attaching (i.e. parenting) a nested childGameObjectthat includes anAttachableBehaviourcomponent to another nested childGameObjectwith anAttachableNodecomponent that is associated with a differentNetworkObject.AttachableNode: This component is required by theAttachableBehaviourcomponent in order to be able to attach (i.e. parent) to another GameObject without having to parent the entireNetworkObjectcomponent theAttachableBehaviourcomponent is associated with.ComponentController: This component provides users the ability to synchronize the enabling or disabling of anyObjectderived component that has anenabledproperty.This PR also incorporates a new "Helpers" subfolder under the NGO components folder where additional helper components will live.
Documentation Update
New Documentation
AttachableBehaviour
Network Components Section Update
New Foundational Components Section
New Helper Components Section
NetworkBehaviour.OnNetworkPreDespawn
Added another virtual method to
NetworkBehaviour,OnNetworkPreDespawn, that is invoked before running through the despawn sequence for theNetworkObjectand allNetworkBehaviourchildren of theNetworkObjectbeing despawned. This provides an opportunity to do any kind of cleanup up or last micro-second state updates prior to despawning.Changelog
AttachableBehaviourhelper component to provide an alternate approach to parenting items without using theNetworkObjectparenting.AttachableNodehelper component that is used byAttachableBehaviouras the target node for parenting.ComponentControllerhelper component that can be used to synchronize the enabling and disabling of components and can be used in conjunction withAttachableBehaviour.NetworkBehaviour.OnNetworkPreDespawnthat is invoked before running through the despawn sequence for theNetworkObjectand allNetworkBehaviourchildren of theNetworkObjectbeing despawned.Documentation
Testing & QA
Functional Testing
Manual testing :
Manual testing doneAttachableBehaviourmanual test PR-42Automated tests:
Covered by existing automated testsCovered by new automated testsDoes the change require QA team to:
Review automated tests?Execute manual tests?If any boxes above are checked, please add QA as a PR reviewer.
Backport
This is a v2.x only feature.