Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
local M = UnLua.Class()

function M:CollectInfo()
return self.Overridden.CollectInfo(self) + 1
end

return M
8 changes: 6 additions & 2 deletions Plugins/UnLua/Source/UnLua/Private/LuaOverridesClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ void ULuaOverridesClass::AddToOwner()
if (!Class)
return;

#if UE_VERSION_NEWER_THAN(5, 2, 1)
#if UE_VERSION_NEWER_THAN(5, 2, 1) && UE_VERSION_OLDER_THAN(5, 7, 0)
// 5.3~5.6: Children is TObjectPtr but UField::Next is still a raw pointer,
// so the chain cannot be walked in place with a single slot type
auto ChildrenPtr = Class->Children.Get();

auto Field = &ChildrenPtr;
Expand Down Expand Up @@ -101,7 +103,9 @@ void ULuaOverridesClass::RemoveFromOwner()
if (!Class)
return;

#if UE_VERSION_NEWER_THAN(5, 2, 1)
#if UE_VERSION_NEWER_THAN(5, 2, 1) && UE_VERSION_OLDER_THAN(5, 7, 0)
// 5.3~5.6: Children is TObjectPtr but UField::Next is still a raw pointer,
// so the chain cannot be walked in place with a single slot type
auto ChildrenPtr = Class->Children.Get();

auto Field = &ChildrenPtr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ void FLuaDeadLoopCheckSpec::Define()

It(TEXT("设置防止无限循环的超时时间"), EAsyncExecution::TaskGraphMainThread, [this]()
{
// a preceding PIE-based test deactivates UnLua on a deferred tick, so the module
// may still be active here; Startup() would then early-return without applying
// DeadLoopCheck to FDeadLoopCheck::Timeout and the chunk below never times out
UnLua::Shutdown();

auto& Settings = *GetMutableDefault<UUnLuaSettings>();
Settings.DeadLoopCheck = 1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,17 @@ void FUnLuaLibClassSpec::Define()
{
It(TEXT("正确获取类默认对象"), EAsyncExecution::TaskGraphMainThread, [this]()
{
const UObject* Expected = LoadClass<AGameModeBase>(nullptr, TEXT("/Game/Core/Blueprints/BP_Game.BP_Game_C"))->GetDefaultObject();
const auto Class = LoadClass<AGameModeBase>(nullptr, TEXT("/Game/Core/Blueprints/BP_Game.BP_Game_C"));
if (!TestNotNull(TEXT("BP_Game class"), Class))
return;
const UObject* Expected = Class->GetDefaultObject();
const char* Chunk = "\
local GameModeClass = UE.UClass.Load('/Game/Core/Blueprints/BP_Game.BP_Game_C')\
return GameModeClass:GetDefaultObject()";
UnLua::RunChunk(L, Chunk);
const UObject* Actual = static_cast<UObject*>(UnLua::GetPointer(L, -1));
// UObject userdata is managed by FObjectRegistry, so it must be read back
// with GetUObject; GetPointer only understands raw/smart-pointer userdata
const UObject* Actual = UnLua::GetUObject(L, -1);
TEST_EQUAL(Actual, Expected);
});
});
Expand Down
5 changes: 4 additions & 1 deletion Source/TPSProject.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ public class TPSProjectTarget : TargetRules
public TPSProjectTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
#if UE_5_4_OR_LATER
#if UE_5_7_OR_LATER
DefaultBuildSettings = BuildSettingsVersion.V6;
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
#elif UE_5_4_OR_LATER
DefaultBuildSettings = BuildSettingsVersion.V4;
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
#else
Expand Down
5 changes: 4 additions & 1 deletion Source/TPSProjectEditor.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ public class TPSProjectEditorTarget : TargetRules
public TPSProjectEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
#if UE_5_4_OR_LATER
#if UE_5_7_OR_LATER
DefaultBuildSettings = BuildSettingsVersion.V6;
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
#elif UE_5_4_OR_LATER
DefaultBuildSettings = BuildSettingsVersion.V4;
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
#else
Expand Down
5 changes: 4 additions & 1 deletion Source/TPSProjectServer.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ public class TPSProjectServerTarget : TargetRules
public TPSProjectServerTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Server;
#if UE_5_4_OR_LATER
#if UE_5_7_OR_LATER
DefaultBuildSettings = BuildSettingsVersion.V6;
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
#elif UE_5_4_OR_LATER
DefaultBuildSettings = BuildSettingsVersion.V4;
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
#else
Expand Down
2 changes: 1 addition & 1 deletion TPSProject.uproject
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"FileVersion": 3,
"EngineAssociation": "5.6",
"EngineAssociation": "5.7",
"Category": "",
"Description": "",
"Modules": [
Expand Down