Script.md

July 25, 2024 ยท View on GitHub

Friflo.Engine.ECS

Friflo.Engine.ECS

Script Class

To enable adding a script class to an Entity it need to extend Script.
See Example.

public abstract class Script

Inheritance System.Object ๐Ÿก’ Script

Remarks

A Script is a reference type - a class- which contains data and behavior - aka scripts / methods.
An Entity can contain multiple Script's but only one of each type.
Script's can be used if OPP programming approach is preferred and dealing with less than a few 1.000 instances.

Optionally attribute the extended class with ComponentKeyAttribute
to assign a custom component key name used for JSON serialization.

Info: Its functionality is similar to a class extending MonoBehaviour added to a GameObject in Unity.

Properties
EntityThe entity the component is added to. Otherwise null.
Store
Methods
Start()
ToString()
Update()