Component:ValueUserOverride: Difference between revisions

From Resonite Wiki
m PJB moved page Component:ValueUserOverride`1 to Component:ValueUserOverride: Remove `N suffix from generic types
m Remove `N suffix from generic types
Line 4: Line 4:
{{Infobox Component
{{Infobox Component
|Image=ValueUserOverride`1Component.png
|Image=ValueUserOverride`1Component.png
|Name=ValueUserOverride`1
|Name=ValueUserOverride
}}
}}
== Intoduction ==
== Intoduction ==
The '''ValueUserOverride`1''' Component allows for the driving of a value for each user listed in <code>_overrides</code>
The '''ValueUserOverride''' Component allows for the driving of a value for each user listed in <code>_overrides</code>
== Usage ==
== Usage ==
{{Table ComponentFields
{{Table ComponentFields
Line 21: Line 21:
<code>CreateOverrideOnWrite</code> allows for new users and values to be added to the bag when the driven value in <code>Target</code> is directly or indirectly changed by that user. If it is not enabled, the value in <code>Target</code> is not changeable.
<code>CreateOverrideOnWrite</code> allows for new users and values to be added to the bag when the driven value in <code>Target</code> is directly or indirectly changed by that user. If it is not enabled, the value in <code>Target</code> is not changeable.


Attempting to write to or otherwise cause a discrete entry to a driven field is known as Hooking it. Any Hook to the <code>Target</code> value is intercepted by the '''ValueUserOverride`1''' Component and will change the modifying user's entry in the <code>_overrides</code> bag. If there is no entry for the user and if <code>CreateOverrideOnWrite</code> is enabled, it will create an entry using the set value.
Attempting to write to or otherwise cause a discrete entry to a driven field is known as Hooking it. Any Hook to the <code>Target</code> value is intercepted by the '''ValueUserOverride''' Component and will change the modifying user's entry in the <code>_overrides</code> bag. If there is no entry for the user and if <code>CreateOverrideOnWrite</code> is enabled, it will create an entry using the set value.
== Examples ==
== Examples ==
* [https://www.youtube.com/watch?v=aER4oQ9FwSE ValueUserOverride for Local World State] by [[User:ProbablePrime|ProbablePrime]]
* [https://www.youtube.com/watch?v=aER4oQ9FwSE ValueUserOverride for Local World State] by [[User:ProbablePrime|ProbablePrime]]
Line 28: Line 28:
</translate>
</translate>
[[Category:Generics{{#translation:}}]]
[[Category:Generics{{#translation:}}]]
[[Category:Components{{#translation:}}|ValueUserOverride`1 (Component){{#translation:}}]]
[[Category:Components{{#translation:}}|ValueUserOverride (Component){{#translation:}}]]
[[Category:Components:Transform:Drivers{{#translation:}}|ValueUserOverride`1 (Component){{#translation:}}]]
[[Category:Components:Transform:Drivers{{#translation:}}|ValueUserOverride (Component){{#translation:}}]]

Revision as of 05:24, 19 February 2024


This article or section is a Stub. You can help the Resonite Wiki by expanding it.


Component image 
ValueUserOverride component as seen in the Scene Inspector

Intoduction

The ValueUserOverride Component allows for the driving of a value for each user listed in _overrides

Usage

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
Target T Target field of the specified type, that gets driven to the override value.
Default T The default value given to Target if no suitable override exists in _overrides
CreateOverrideOnWrite Bool Creates an entry in _overrides when Target is written back.
PersistentOverrides Bool Values in _overrides are stored with the object when it is saved
_overrides ValueUserOverride<T> A list of Overrides and the corresponding users they apply to.

Behavior

The _overrides bag contains a list of users and their associated values - whenever the local user matches a user entry in the bag, the associated value is driven to Target. Otherwise, Target is driven to the value in Default

CreateOverrideOnWrite allows for new users and values to be added to the bag when the driven value in Target is directly or indirectly changed by that user. If it is not enabled, the value in Target is not changeable.

Attempting to write to or otherwise cause a discrete entry to a driven field is known as Hooking it. Any Hook to the Target value is intercepted by the ValueUserOverride Component and will change the modifying user's entry in the _overrides bag. If there is no entry for the user and if CreateOverrideOnWrite is enabled, it will create an entry using the set value.

Examples

Related Components