Base class for Fusion network components, which are associated with a NetworkObject.
More...
Inherits SimulationBehaviour, ISpawned, and IDespawned.
Inherited by HitboxRoot, NetworkAreaOfInterestBehaviour, and NetworkMecanimAnimator.
|
| struct | Interpolator |
| | Interpolator provides a set of methods to get the "from" and "to" ticks of the associated [Networked] property, as well as the current interpolation value for the two, but it also provides a Value property as a shortcut to get the actual interpolated value for those parameters. - See also
- RawInterpolator
More...
|
| |
| struct | RawInterpolator |
| | RawInterpolator provides a set of methods to get the "from" and "to" ticks of the associated [Networked] property, as well as the current interpolation value for the two. All methods return raw memory pointers and expects the caller to be able to convert the data to the proper types. - See also
- Interpolator<T>
More...
|
| |
|
| void | CopyStateFrom (NetworkBehaviour source) |
| | Copies entire state of passed in source NetworkBehaviour More...
|
| |
| virtual void | Despawned (NetworkRunner runner, bool hasState) |
| | Called before the network object is despawned More...
|
| |
| override void | FixedUpdateNetwork () |
| | Fusion FixedUpdate timing callback. More...
|
| |
| T? | GetInput< T > () |
| |
| bool | GetInput< T > (out T input) |
| | Returns true if it a valid INetworkInput can be found for the current simulation tick (Typically this is used in FixedUpdateNetwork). More...
|
| |
| bool | GetInterpolationData (out InterpolationData data, bool? predicted=null) |
| | Get 'To' and 'From' states, and the Alpha (t) values needed for lerping. More...
|
| |
| bool | GetInterpolationData (out InterpolationData data, out bool predicted) |
| | Get 'To' and 'From' states, and the Alpha (t) values needed for interpolation. More...
|
| |
| RawInterpolator | GetInterpolator (string propertyName) |
| | Get a raw interpolator for a networked property. The returned RawInterpolator provides a way to calculate the "between-ticks" value of the named [Networked] property. More...
|
| |
| Interpolator< T > | GetInterpolator< T > (string propertyName) |
| | Get an interpolator for a networked property. The returned Interpolator provides a way to calculate the "between-ticks" value of the named [Networked] property with the specified type T. The value is a linear interpolation between the "from" and the "to" ticks and is available via the Value property on the Interpolator. More...
|
| |
| int | GetLocalAuthorityMask () |
| | Gets a bitmask of AuthorityMasks flags, representing the current local authority over this NetworkObject. More...
|
| |
| virtual bool | IsInterpolationDataPredicted () |
| | If the behaviour data should be interpolated between latest predicted states or between snapshots. More...
|
| |
| NetworkBehaviourCallbackReference | OnChangeAdd< T > (int wordOffset, int wordCount, ChangedDelegate< T > callback, OnChangedTargets targets=OnChangedTargets.All) |
| | Adds a OnChange callback to this behaviour which is bound to a specific word offset and word count More...
|
| |
| NetworkBehaviourCallbackReference | OnChangeAdd< T > (string propertyName, ChangedDelegate< T > callback, OnChangedTargets targetses=OnChangedTargets.All) |
| | Adds a OnChange callback to this behaviour which is bound to a specific weaved property More...
|
| |
| void | OnChangeClearAll () |
| | Clear all dynamic OnChange callbacks from this behaviour More...
|
| |
| bool | OnChangeRemove (NetworkBehaviourCallbackReference reference) |
| | Removes a specific OnChange callback from this behaviour More...
|
| |
| virtual void | Spawned () |
| | Post spawn callback. More...
|
| |
| virtual void | Render () |
| | Post simulation frame rendering callback. Runs after all simulations have finished. Use in place of Unity's Update when Fusion is handling Physics. More...
|
| |
| T | AddBehaviour< T > () |
| | Wrapper for Unity's GameObject.AddComponent() More...
|
| |
| T | GetBehaviour< T > () |
| | Wrapper for Unity's GameObject.GetComponentInChildren() More...
|
| |
| bool | TryGetBehaviour< T > (out T behaviour) |
| | Wrapper for Unity's GameObject.TryGetComponent() More...
|
| |
Base class for Fusion network components, which are associated with a NetworkObject.
Derived from SimulationBehaviour, components derived from this class are associated with a NetworkRunner and Simulation. Components derived from this class are associated with a parent NetworkObject. and can use the NetworkedAttribute on properties to automate state synchronization, and can use the RpcAttribute on methods, to automate messaging.
◆ InterpolationDataSources
Options for which time frame this object will render in.
| Enumerator |
|---|
| Auto | Selects the most likely suitable time frame.
|
| Snapshots | Renders the object in the remote time frame, using the most recently consumed remote state tick.
|
| Predicted | Render the object in the local players time frame, interpolating between the most recent tick simulation result and the previous.
|
| NoInterpolation | Interpolation will not be calculated nor applied.
|
◆ CopyStateFrom()
◆ Despawned()
Called before the network object is despawned
- Parameters
-
| hasState | If the state of the behaviour is still accessible |
Reimplemented in HitboxRoot, and NetworkTransform.
◆ FixedUpdateNetwork()
| override void FixedUpdateNetwork |
( |
| ) |
|
|
virtual |
◆ GetInput< T >() [1/2]
- Template Parameters
-
- Type Constraints
-
| T | : | unmanaged | |
| T | : | INetworkInput | |
◆ GetInput< T >() [2/2]
| bool GetInput< T > |
( |
out T |
input | ) |
|
Returns true if it a valid INetworkInput can be found for the current simulation tick (Typically this is used in FixedUpdateNetwork).
The returned input struct originates from the NetworkObject.InputAuthority, and if valid contains the inputs supplied by that PlayerRef for the current simulation tick.
- Type Constraints
-
| T | : | unmanaged | |
| T | : | INetworkInput | |
◆ GetInterpolationData() [1/2]
| bool GetInterpolationData |
( |
out InterpolationData |
data, |
|
|
bool? |
predicted = null |
|
) |
| |
Get 'To' and 'From' states, and the Alpha (t) values needed for lerping.
- Parameters
-
| data | The returned values. |
| predicted | Force interpolation to the current Simulations time frame |
- Returns
- True valid state data was returned.
◆ GetInterpolationData() [2/2]
| bool GetInterpolationData |
( |
out InterpolationData |
data, |
|
|
out bool |
predicted |
|
) |
| |
Get 'To' and 'From' states, and the Alpha (t) values needed for interpolation.
- Parameters
-
| data | The returned values. |
| predicted | If the interpolation data is in the predicted time frame (true) or between snapshots (false), according to the InterpolationDataSource. |
- Returns
- True valid state data was returned.
◆ GetInterpolator()
Get a raw interpolator for a networked property. The returned RawInterpolator provides a way to calculate the "between-ticks" value of the named [Networked] property.
- Parameters
-
| propertyName | Name of the [Networked] property |
- Returns
RawInterpolator for the networked property
◆ GetInterpolator< T >()
Get an interpolator for a networked property. The returned Interpolator provides a way to calculate the "between-ticks" value of the named [Networked] property with the specified type T. The value is a linear interpolation between the "from" and the "to" ticks and is available via the Value property on the Interpolator.
- Parameters
-
| propertyName | Name of the [Networked] property |
- Template Parameters
-
| T | Type of the [Networked] property |
- Returns
Interpolator for the networked property
◆ GetLocalAuthorityMask()
| int GetLocalAuthorityMask |
( |
| ) |
|
◆ IsInterpolationDataPredicted()
| virtual bool IsInterpolationDataPredicted |
( |
| ) |
|
|
virtual |
If the behaviour data should be interpolated between latest predicted states or between snapshots.
- Returns
Reimplemented in NetworkRigidbodyBase.
◆ MakeInitializer< K, V >()
| static NetworkBehaviourUtils.DictionaryInitializer<K, V> MakeInitializer< K, V > |
( |
Dictionary< K, V > |
dictionary | ) |
|
|
static |
This is a special method that is meant to be used only for [Networked] properties inline initialization.
◆ MakeInitializer< T >()
| static NetworkBehaviourUtils.ArrayInitializer<T> MakeInitializer< T > |
( |
T[] |
array | ) |
|
|
static |
This is a special method that is meant to be used only for [Networked] properties inline initialization.
◆ OnChangeAdd< T >() [1/2]
Adds a OnChange callback to this behaviour which is bound to a specific word offset and word count
- Parameters
-
| wordOffset | Word offset to monitor for changes |
| wordCount | How many words to monitor for changes, from offset and up |
| callback | Callback to invoke |
- Template Parameters
-
- Returns
- Reference struct that can be used to remove this callback later
◆ OnChangeAdd< T >() [2/2]
Adds a OnChange callback to this behaviour which is bound to a specific weaved property
- Parameters
-
| propertyName | Name of the property to monitor for changes |
| callback | Callback to invoke |
- Template Parameters
-
- Returns
- Reference struct that can be used to remove this callback later
◆ OnChangeClearAll()
| void OnChangeClearAll |
( |
| ) |
|
Clear all dynamic OnChange callbacks from this behaviour
◆ OnChangeRemove()
Removes a specific OnChange callback from this behaviour
- Parameters
-
| reference | The reference returned by OnChangeAdd |
- Returns
- Removal succeeded
◆ operator NetworkBehaviourId()
◆ Spawned()
◆ ObjectIndex
◆ offset
Gives access to the offset (in 32 bit words) and count (in 32 bit words) of this behaviour backing data
◆ Ptr
Pointer to the allocated memory associated with this Object.
◆ DynamicWordCount
| virtual ? int DynamicWordCount |
|
get |
Override this value for custom memory allocations. This is for advanced use cases only, and cannot be used if NetworkedAttribute is used in the derived class.
◆ Id
The unique identifier for this network behaviour.
◆ InterpolationDataSource
Get/Set the time frame this object is rendered in.
◆ InvokeOnChangedForInitialNonZeroValues
| virtual bool InvokeOnChangedForInitialNonZeroValues |
|
get |
Override this property to change whether initial non-zero values assigned to [Networked] properties invoke OnChanged callbacks. For clients the initial value comes from the simulation snapshot, not from what has been set locally in the inspector.
Returns "true" by default.