Interval Service Node

Type description and basic instructions.

Description

Interval Service Node is base abstract class for all service nodes that have specified tick frequency.

To create a custom interval service node you should inherit from Interval Service Node class and implement logic that is described below.

OnTick

When inheriting from Task Node you have to override OnTick method.

public class ExampleServiceNode : ServiceNode
{
    protected override void OnTick()
    {
        throw new NotImplementedException();
    }
}
  • OnTick contains logic of service tick.

  • OnTick gets called every time during node execution.

How to set tick frequency

Interval Service Node has a set of fields for specifying tick frequency

public abstract class IntervalServiceNode : ServiceNode
{
    [Title("Service")]
    [SerializeField]
    [Min(0.001f)]
    private float interval = .5f;

    [SerializeField]
    [Min(0f)]
    private float randomDeviation = .1f;
    
    ...
}

Serialized fields

Name
Description

interval

Time between ticks

randomDeviation

Random deviation of time between ticks.

To create custom service nodes in editor you should add Node Content attribute to your custom task node class.

Last updated