MCPcopy Create free account
hub / github.com/Tencent/UnLua / SetActive

Method SetActive

Plugins/UnLua/Source/UnLua/Private/UnLuaModule.cpp:112–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110 }
111
112 virtual void SetActive(const bool bActive) override
113 {
114 if (bIsActive == bActive)
115 return;
116
117 if (bActive)
118 {
119 const auto& Settings = *GetDefault<UUnLuaSettings>();
120 FDeadLoopCheck::Timeout = Settings.DeadLoopCheck;
121 FDanglingCheck::Enabled = Settings.DanglingCheck;
122
123 for (const auto Class : TObjectRange<UClass>())
124 {
125 for (const auto& ClassPath : Settings.PreBindClasses)
126 {
127 if (!ClassPath.IsValid())
128 continue;
129
130 const auto TargetClass = ClassPath.ResolveClass();
131 if (!TargetClass)
132 continue;
133
134 if (Class->IsChildOf(TargetClass))
135 {
136 const auto Env = EnvLocator->Locate(Class);
137 Env->TryBind(Class);
138 break;
139 }
140 }
141 }
142 }
143 else
144 {
145 for (const auto Class : TObjectRange<UClass>())
146 {
147 if (!Class->ImplementsInterface(UUnLuaInterface::StaticClass()))
148 continue;
149#if WITH_EDITOR
150 if (Class->HasAnyClassFlags(CLASS_NewerVersionExists))
151 continue;
152 const auto CDO = Class->GetDefaultObject(false);
153 if (CDO && IUnLuaInterface::Execute_RunInEditor(CDO))
154 continue;
155#endif
156 ULuaFunction::RestoreOverrides(Class);
157 }
158 EnvLocator->Reset();
159 }
160
161 bIsActive = bActive;
162 }
163
164 virtual FLuaEnv* GetEnv(UObject* Object) override
165 {

Callers 3

CreateStateFunction · 0.80
StartupFunction · 0.80
ShutdownFunction · 0.80

Calls 4

TryBindMethod · 0.80
IsValidMethod · 0.45
LocateMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected