-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instanced Lua State System #27
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested it out and seems to be working well - however quite a serious garbage collection issue when you don't reference the LuaState within blueprints / elsewhere.
|
||
LuaState = NewObject<ULuaState>(this, LuaStateClass); | ||
LuaState->GetLuaState(GetWorld()); | ||
LuaState->ReceiveLuaLevelAddedToWorld(GetOwner()->GetLevel(), GetWorld()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe here we're going to want to add:
LuaState->AddToRoot();
With a corresponding ->RemoveFromRoot(); on a destructor/DestroyLuaState().
Without this the LuaState will get garbage collected out from under you if you don't reference it anywhere in blueprints.
Ran into this issue as we were only accessing it via the pure getters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend just adding the UPROPERTY macro above the lua state reference, this should keep it protected from garbage collection as long as the outer is the LuaStateComponent
@Dgrouse96 I like it, i will need a bit to merge it as i want it to became a first citizen in the plugin so i need to do a bit of refactoring of other parts of the code. |
@Dgrouse96 starting another attempt at merging it, sorry again for the huge late :) |
Added blueprint functions for lua states, added LuaStateComponent for an instantiation example
LuaStateComponent could possibly be merged with LuaComponent, up to you. Left out http functions for now, you should look into it later.