[EntityEditorProps(category: "GameScripted/ScriptWizard", description: "ScriptWizard generated script file.")]
class SCR_MyClassClass : ScriptComponentClass
{
// prefab properties here
}
class ClassA : Managed
{
void OnSuccess()
{
Print("it ran");
}
//------------------------------------------------------------------------------------------------
void ClassA()
{
}
}
void DoSomethingThread(notnull ClassA param)
{
int i = param.GetRefCount();
Print(i.ToString());
Sleep(5000);
//here it can happen that param was cleaned up and is null
i = param.GetRefCount();
param.OnSuccess();
}
//------------------------------------------------------------------------------------------------
class SCR_MyClass : ScriptComponent
{
override void EOnInit(IEntity owner)
{
ClassA test = new ClassA();
thread DoSomethingThread(test);
}
override void OnPostInit(IEntity owner)
{
SetEventMask(owner, EntityEvent.INIT);
}
//------------------------------------------------------------------------------------------------
void SCR_MyClass(IEntityComponentSource src, IEntity ent, IEntity parent)
{
}
//------------------------------------------------------------------------------------------------
void ~SCR_MyClass()
{
}
}```
[EntityEditorProps(category: "GameScripted/ScriptWizard", description: "ScriptWizard generated script file.")]
class SCR_MyClassClass : ScriptComponentClass
{
// prefab properties here
}
class ClassA : Managed
{
void OnSuccess()
{
Print("it ran");
}
//------------------------------------------------------------------------------------------------
void ClassA()
{
}
}
void DoSomethingThread(notnull ClassA param)
{
int i = param.GetRefCount();
Print(i.ToString());
Sleep(5000);
//here it can happen that param was cleaned up and is null
i = param.GetRefCount();
param.OnSuccess();
}
//------------------------------------------------------------------------------------------------
class SCR_MyClass : ScriptComponent
{
override void EOnInit(IEntity owner)
{
ClassA test = new ClassA();
thread DoSomethingThread(test);
}
override void OnPostInit(IEntity owner)
{
SetEventMask(owner, EntityEvent.INIT);
}
//------------------------------------------------------------------------------------------------
void SCR_MyClass(IEntityComponentSource src, IEntity ent, IEntity parent)
{
}
//------------------------------------------------------------------------------------------------
void ~SCR_MyClass()
{
}
}
```
Add the component to an entity.