Editor模块
在节点中声明gameobject为this

public class AIShootEventNode : Unit{ [DoNotSerialize] [PortLabelHidden] public ControlInput InputTrigger { get; private set; } [DoNotSerialize] [NullMeansSelf] [PortLabel("Target")] [PortLabelHidden] public ValueInput Target; [DoNotSerialize] public ValueInput ShootTarget; protected override void Definition() { InputTrigger = ControlInput(nameof(InputTrigger), Trigger); //在节点中声明gameobject为this Target = ValueInput<GameObject>(nameof(Target), null).NullMeansSelf(); ShootTarget = ValueInput<RoundState>(nameof(ShootTarget), RoundState.Deler); } private ControlOutput Trigger(Flow flow) { EventBus.Trigger(MachineEventNames.AIUsePropEvent, flow.GetValue<GameObject>(Target), flow.GetValue<RoundState>(ShootTarget)); return null; }}
特性
PortLabel:修改端口的显示文本

[DoNotSerialize][PortLabel("实弹")]public ControlOutput BulletIsLive;
Runtime模块
运行时替换ScriptMachine.asset
scriptMachine = gameObject.AddComponent<ScriptMachine>();scriptMachine.nest.SwitchToMacro(yourGraph);