Properties
- To expose C# Properties ingame add a [MBMember] or [MBReadOnly] attribute
[MBReadOnly]
[MBSuffix("x")]
[MBDescription("Percentage of health to Start health")]
[MBHideWidgetIfDefault]
public float HealthPercentage => Health.Value / StartHealth.Value;
'HideWidgetIfDefault' can be used to not show the value if it's default (0 for numbers, empty/null for strings)
Can also use [MBMember] on Methods:
[MBMember]
public void ClearTargetAndMoveGoal()
{
MoveGoalWorldPosition.SetValueOnline(Vector3.zero);
MoveGoalEntity.SetValueOnline(null);
MoveGoalRange.SetValueOnline(Range.Zero);
Target.SetValueOnline(null);
}
Should only use this on Methods that don't need to be called on all clients (in this example the value variables are synced). Otherwise should use a 'OnlineVoidMethod' MBVariables
Updated almost 2 years ago