Open 3D Engine AzFramework API Reference  2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
AzFramework::ScriptComponent Class Reference

Inherits Component, and Handler.

Public Member Functions

 AZ_COMPONENT (AzFramework::ScriptComponent, "{8D1BC97E-C55D-4D34-A460-E63C57CD0D4B}", AZ::Component)
 
AZ::ScriptContext * GetScriptContext () const
 
void SetScriptContext (AZ::ScriptContext *context)
 
const AZ::Data::Asset< AZ::ScriptAsset > & GetScript () const
 
void SetScript (const AZ::Data::Asset< AZ::ScriptAsset > &script)
 
AZ::ScriptProperty * GetScriptProperty (const char *propertyName)
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *reflection)
 \red ComponentDescriptor::Reflect
 

Static Public Attributes

static const char * DefaultFieldName
 

Protected Member Functions

 ScriptComponent (const ScriptComponent &)=delete
 
void Init () override
 
void Activate () override
 
void Deactivate () override
 
void OnAssetReady (AZ::Data::Asset< AZ::Data::AssetData > asset) override
 
void OnAssetReloaded (AZ::Data::Asset< AZ::Data::AssetData > asset) override
 
void LoadScript ()
 Load script (unless already by other instances) and creates the script instance into the VM.
 
void UnloadScript ()
 Removes the script instance and unloads the script (unless needed by other instances)
 
bool LoadInContext ()
 Loads the script into the context/VM,. More...
 
void CreateEntityTable ()
 
void DestroyEntityTable ()
 
void CreatePropertyGroup (const ScriptPropertyGroup &group, int propertyGroupTableIndex, int parentIndex, int metatableIndex, bool isRoot)
 

Protected Attributes

AZ::ScriptContext * m_context
 Context in which the script will be running.
 
AZ::ScriptContextId m_contextId
 Id of the script context.
 
AZ::Data::Asset< AZ::ScriptAsset > m_script
 Reference to the script asset used for this component.
 
int m_table
 Cached table index.
 
ScriptPropertyGroup m_properties
 List with all properties that were tweaked in the editor and should override values in the m_sourceScriptName class inside m_script.
 

Friends

class AzToolsFramework::Components::ScriptEditorComponent
 

Member Function Documentation

◆ LoadInContext()

bool AzFramework::ScriptComponent::LoadInContext ( )
protected

Loads the script into the context/VM,.

Returns
true if the script is loaded

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