Raven Engine v0.1
A modern 3D Game Engine
Loading...
Searching...
No Matches
Raven::ScriptBase Class Reference

Abstract base class for all user-authored native scripts. More...

#include <ScriptBase.h>

Public Member Functions

virtual ~ScriptBase ()=default
virtual void OnCreate ()
 Called once after the script instance is created and fields are applied.
virtual void OnUpdate (float dt)
 Called every frame while the scene is running.
virtual void OnDestroy ()
 Called once just before the script instance is destroyed.

Public Attributes

u64 EntityID = 0
 ECS identifier of the entity this script is attached to.
RegistryScene = nullptr
 Non-owning pointer to the scene's ECS registry. Valid during play mode only.

Detailed Description

Abstract base class for all user-authored native scripts.

User scripts inherit from ScriptBase inside their script DLL and override whichever lifecycle methods they need. The engine never calls these directly it goes through ScriptRuntime, which guards each call with SEH.

EntityID and Scene are injected by ScriptRuntime::OnRuntimeStart before OnCreate is called and are valid for the entire play-mode session.

Constructor & Destructor Documentation

◆ ~ScriptBase()

virtual Raven::ScriptBase::~ScriptBase ( )
virtualdefault

Member Function Documentation

◆ OnCreate()

virtual void Raven::ScriptBase::OnCreate ( )
inlinevirtual

Called once after the script instance is created and fields are applied.

Override to perform one-time initialisation (e.g. caching component pointers, spawning child entities).

◆ OnDestroy()

virtual void Raven::ScriptBase::OnDestroy ( )
inlinevirtual

Called once just before the script instance is destroyed.

Override to release any resources acquired in OnCreate.

◆ OnUpdate()

virtual void Raven::ScriptBase::OnUpdate ( float dt)
inlinevirtual

Called every frame while the scene is running.

Parameters
dtTime elapsed since the previous frame (seconds).

Member Data Documentation

◆ EntityID

u64 Raven::ScriptBase::EntityID = 0

ECS identifier of the entity this script is attached to.

◆ Scene

Registry* Raven::ScriptBase::Scene = nullptr

Non-owning pointer to the scene's ECS registry. Valid during play mode only.


The documentation for this class was generated from the following file: