Custom Extensions
Introduction
Extension Workflow refers to the process of inheriting from existing extension classes to create your own customized classes. Extension classes can be inherited to provide a set of overridable methods for you to create your customized code triggered by any event you need.
What are Extension Classes?
Extension classes are predefined classes that provide a base set of functionalities for you to create your own custom Components that are preconnected to specific Axis components. These classes are designed to be inherited by your custom classes, allowing for the addition of new methods, properties, and behaviors without modifying the original class, and able to be enabled and disabled at your will turning on and off all default listeners.
Click here to learn more about the predefined options Axis already offer
Benefits
Axis default extension classes offer a streamlined approach to enhancing Axis functionality or integrating it with custom systems. These classes are preconfigured to manage event listeners associated with UnityEvents across Axis components.
How to Use Extension Classes
Inherit from Extension Classes
To create a customized class by inheriting from an extension class, follow these steps:
- Identify the Extension Class: Choose the extension class that provides the base functionalities you need.
- Create Your Custom Class: Define your new class and use the
: baseClassName
syntax to inherit from the extension class. - Override or Add Methods and Properties: Customize your class by adding new methods and properties or overriding existing ones.
Example
Here's an example demonstrating how to inherit from NavObjectExtension class to create a customized class:
// Custom class inheriting from NavObjectExtension
public class CustomClass : NavObjectExtension
{
// Override the OnLinkEnter method
protected override void OnLinkEnter(NavLink link){
NavObject ThisObject = GetComponent<NavObject>();
}
}