Custom Component Actions
using UnityEngine;
[System.Serializable]
public abstract class ComponentAction
{
[SerializeField] internal Component component;
public Component Component => component;
public virtual void OnAuthority() { }
public virtual void OnRemote() { }
}using Coherence.Toolkit;
using UnityEngine;
[ComponentAction(typeof(Behaviour), "Disable")]
public class DisableBehaviourComponentAction : ComponentAction
{
public override void OnAuthority()
{
var b = Component as Behaviour;
b.enabled = true;
}
public override void OnRemote()
{
var b = Component as Behaviour;
b.enabled = false;
}
}Was this helpful?

