Event Nodes (Manually)
This guide will walk you through creating event nodes in Jungle manually. Let's get started!
Step 1: Create a New C# Script
First, create a new C# script in your Unity project.
Step 2: Inherit from EventNode
Next, make your new class inherit from the EventNode
class.
This will form the foundation of your event node.
using Jungle;
// ↓↓↓↓↓↓↓↓↓
public class MyEventNode : EventNode
{
}
Step 3: Implement OnStart
and OnUpdate
Now, you need to implement the OnStart
and OnUpdate
methods.
using Jungle;
public class MyEventNode : EventNode
{
// ↓↓↓↓↓↓↓
protected override void OnStart()
{
}
// ↓↓↓↓↓↓↓↓
protected override void OnUpdate()
{
}
}
Step 4: Add the EventNode
Attribute
Add the EventNode
attribute to your class.
This defines the output ports.
using Jungle;
// ↓↓↓↓↓↓↓
[EventNode(
OutputPortNames = new []
{
"My Output 1",
"My Output 2"
},
OutputPortTypes = new []
{
typeof(OUTPUT_TYPE),
typeof(OUTPUT_TYPE)
}
)]
public class MyEventNode : EventNode
{
protected override void OnStart()
{
}
protected override void OnUpdate()
{
}
}
Step 5: Add the NodeProperties
Attribute
Finally, add the NodeProperties
attribute to your class.
This defines additional properties such as the title, description, and category of your node.
using Jungle;
// ↓↓↓↓↓↓↓↓↓↓↓↓
[NodeProperties(
Title = "My Event Node",
Description = "This is an Event node.",
Category = "My Nodes/Event",
Color = Green
)]
[EventNode(
OutputPortNames = new []
{
"My Output 1",
"My Output 2"
},
OutputPortTypes = new []
{
typeof(OUTPUT_TYPE),
typeof(OUTPUT_TYPE)
}
)]
public class MyEventNode : EventNode
{
protected override void OnStart()
{
}
protected override void OnUpdate()
{
}
}
With these steps, you've created a basic event node in Jungle. Feel free to customize the output properties to suit your needs!