Skip to content
This repository has been archived by the owner on Nov 12, 2023. It is now read-only.

[EU] Scriptable Objects

Madman10K edited this page Aug 10, 2023 · 5 revisions

Creation

  1. Generate a class using the Build Tool by using the following arguments --scriptable-object <name of the class> --add
  2. You have a Scriptable Object class ready to go

Usage

A Scriptable Object is a gameplay class, of which can multiple instances can exist, instead of just 1 like any other.

They are used primarily for modifying actors in the scene, tracking state that doesn't fit into the other gameplay class' category, or for doing things entirely outside the engine's systems.

Flags

Every Scriptable Object has a specific activity which is stored in a field called activityFlags. This field stores the current state of the actor and therefore controls which events are called(in the next paragraph). The type of this field is an enum and below are the possible values:

SCRIPTABLE_OBJECT_ACTIVITY_FLAG_DISABLED
SCRIPTABLE_OBJECT_ACTIVITY_FLAG_ACTIVE
SCRIPTABLE_OBJECT_ACTIVITY_FLAG_INACTIVE 
  1. Active - uses the regular events
  2. Inactive - uses the inactive events
  3. Disabled - no events are called

Events

Scriptable Objects have the regular 3 events every gameplay class has, but they also have an additional 3 for when the Scriptable Object is in an inactive state

virtual void inactiveTick(float deltaTime) override;
virtual void inactiveBegin() override;
virtual void inactiveEnd() override;

If a Scriptable Object is marked as disabled, no events are called

Casting

You can use the standard cast function to cast between a generic pointer type to it's base type

Clone this wiki locally