asqbtcupid / unreal.lua

lua solution for UnrealEngine4
MIT License
300 stars 98 forks source link

change level in play mode crash #11

Closed mirchd closed 6 years ago

mirchd commented 6 years ago

Hi, If I place a BP which Inherit from a C++ Actor in the editor, and the C++ Actor bind lua. when I play, and change level by code, the engine crash, because the level can't do Garbage collection.

If the C++ Actor don't bind lua, it is work well.

Please help.

asqbtcupid commented 6 years ago

Did you use the master version?And what's your engine version?4.17? if you use the master version,have a look at cmcharacterbase.cpp, The actor override the EndPlay function.That to inform lua dereference this actor in cppobjectbase.lua when this actor endplay(when you change level, all actor will call EndPlay function). And must keep one thing in mind, That is every Uobject referenced in lua won't be garbege collection.I will add auto derefence actor next version,But has work to do.You can try dev version.

mirchd commented 6 years ago

thanks for reply so quickly~ I use 4.16 branch, and engine version is 4.16.3. The C++ Actor override the EndPlay function.

[2018.01.05-03.00.43:904][ 70]LogReferenceChain: (root) GCObjectReferencer /Engine/Transient.GCObjectReferencer_0->UE4Editor-CoreUObject-Win64-Debug.dll!UGCObjectReferencer::AddReferencedObjects() [e:\unreal\unrealengine\engine\source\runtime\coreuobject\private\misc\gcobjectreferencer.cpp:19] [2018.01.05-03.00.43:905][ 70]LogReferenceChain: (PendingKill) NewBlueprint_C /Game/Maps/test/UEDPIE_0_test.test:PersistentLevel.NewBlueprint_2->Outer [2018.01.05-03.00.43:906][ 70]LogReferenceChain: (PendingKill) Level /Game/Maps/test/UEDPIE_0_test.test:PersistentLevel->OwningWorld [2018.01.05-03.00.43:907][ 70]LogReferenceChain: (target) World /Game/Maps/test/UEDPIE_0_test.test [2018.01.05-03.00.44:504][ 70]LogLoad: (Object is not currently rooted)

Fatal error: [File:E:\Unreal\UnrealEngine\Engine\Source\Editor\UnrealEd\Private\EditorEngine.cpp] [Line: 6752] World /Game/Maps/test/UEDPIE_0_test.test not cleaned up by garbage collection! (Object is not currently rooted)

maybe I need upgrade all version to 4.17?

asqbtcupid commented 6 years ago

4.16 branch is far behind the newest version, So it may have some bug. I will release a new version soon(maybe this weekend).The new version can be used in 4.16,4.17,4.18 engine.But i recommand you use 4.17 or upper.There are a lot of improvement in the new version plugin.Faster compile,Faster runtime and more easier to use.You can try dev branch for now.

asqbtcupid commented 6 years ago

try dev-4.16 with 4.16 engine,Because some ue4 assert in dev branch is saved with 4.17 engine,so you can't open it with 4.16 engine.I recommand you to update your engine to 4.17.

mirchd commented 6 years ago

it's a good news, thanks~