Skip to content

Commit 7dcd8c9

Browse files
committed
Exposed BehaviourId as public API on NetworkedBehaviour
1 parent eacd43f commit 7dcd8c9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,25 @@ protected void DeregisterMessageHandler(string name, int counter)
424424
}
425425
}
426426

427+
/// <summary>
428+
/// Gets behaviourId for this NetworkedBehaviour on this NetworkedObject
429+
/// </summary>
430+
/// <returns>The behaviourId for the current NetworkedBehaviour</returns>
431+
public ushort GetBehaviourId()
432+
{
433+
return networkedObject.GetOrderIndex(this);
434+
}
435+
436+
/// <summary>
437+
/// Returns a the NetworkedBehaviour with a given behaviourId for the current networkedObject
438+
/// </summary>
439+
/// <param name="id">The behaviourId to return</param>
440+
/// <returns>Returns NetworkedBehaviour with given behaviourId</returns>
441+
protected NetworkedBehaviour GetBehaviour(ushort id)
442+
{
443+
return networkedObject.GetBehaviourAtOrderIndex(id);
444+
}
445+
427446
private void OnDisable()
428447
{
429448
NetworkedObject.NetworkedBehaviours.Remove(this);

0 commit comments

Comments
 (0)