Be sure to update the identifiers to describe your own behavior, in both the SDK namespace and the class name.
Updating in type.js and instance.js
Likewise in both type.js and instance.js, you must update the following:
BEHAVIOR_CLASS
to refer to your behavior's name
- The
class
name suffixed with Type
or Instance
. (For example the Bullet behavior uses BulletBehavior
, BulletType
and BulletInstance
as the three names.)
The behavior constructor
The main function of behavior.js is to define a class representing your behavior. In the class constructor, the configuration for the behavior is set via the this._info
member, which is an IBehaviorInfo interface. The constructor also reads potentially translated strings from the language subsystem.
For more information about the possible behavior configurations, see the IBehaviorInfo
reference.
Specifying behavior properties
The behavior properties appear in the Properties Bar when instances using the behavior are selected. To set which properties appear, pass an array of PluginProperty to this._info.SetProperties
. An example is shown below. For more details see the PluginProperty
reference. (Note that behaviors use the same property class as plugins, hence re-using the PluginProperty class for behaviors.)
this._info.SetProperties([
new SDK.PluginProperty("integer", "test-property", 0)
]);