You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Dynamic Binding functionality is not working correctly anymore. For example, in this test, the code is selecting a random test module to bind to the BP_GravitySphere actor from the "DynamicBinding" tutorial.
local testModules = {
"Core.Tests.TestActions.BP_TestAction_01",
"Core.Tests.TestActions.BP_TestAction_02",
"Core.Tests.TestActions.BP_TestAction_03",
"Core.Tests.TestActions.BP_TestAction_04"
}
function M:LeftMouseButton_Pressed()
local World = self:GetWorld()
local SpawnClass = self.SpawnClass
local Transform = self.SpawnPointActor:GetTransform()
local AlwaysSpawn = UE.ESpawnActorCollisionHandlingMethod.AlwaysSpawn
-- World:SpawnActor(SpawnClass, Transform, AlwaysSpawn, self, self, "Tutorials.GravitySphereActor")
local LuaModulePath = testModules[math.random(#testModules)]
print(LuaModulePath)
World:SpawnActor(SpawnClass, Transform, AlwaysSpawn, self, self, LuaModulePath):Run()
end
The Test modules are just a simple print:
function BP_TestAction_01:Run()
local msg = [[
Successfully Ran Test Action 01
]]
print(msg)
end
The expected behavior is, each time Left Mouse is pressed, a random Module is selected, bound to the spawned actor and function "Run" is done.
This is not the case, in all cases, the Spawn Actor will be bound to the first module that was bound each time the mouse is clicked:
LogUnLua: Core.Tests.TestActions.BP_TestAction_04
LogUnLua: Successfully Ran Test Action 04
LogUnLua: Core.Tests.TestActions.BP_TestAction_03
LogUnLua: Successfully Ran Test Action 04
LogUnLua: Core.Tests.TestActions.BP_TestAction_03
LogUnLua: Successfully Ran Test Action 04
LogUnLua: Core.Tests.TestActions.BP_TestAction_01
LogUnLua: Successfully Ran Test Action 04
LogUnLua: Core.Tests.TestActions.BP_TestAction_02
LogUnLua: Successfully Ran Test Action 04
LogUnLua: Core.Tests.TestActions.BP_TestAction_02
LogUnLua: Successfully Ran Test Action 04
LogUnLua: Core.Tests.TestActions.BP_TestAction_03
LogUnLua: Successfully Ran Test Action 04
LogUnLua: Core.Tests.TestActions.BP_TestAction_03
LogUnLua: Successfully Ran Test Action 04
LogUnLua: Core.Tests.TestActions.BP_TestAction_03
LogUnLua: Successfully Ran Test Action 04
LogUnLua: Core.Tests.TestActions.BP_TestAction_04
LogUnLua: Successfully Ran Test Action 04
LogUnLua: Core.Tests.TestActions.BP_TestAction_02
LogUnLua: Successfully Ran Test Action 04
LogUnLua: Core.Tests.TestActions.BP_TestAction_01
LogUnLua: Successfully Ran Test Action 04
LogUnLua: Core.Tests.TestActions.BP_TestAction_01
LogUnLua: Successfully Ran Test Action 04
The text was updated successfully, but these errors were encountered:
You cannot bind different lua modules to one UClass, because UFunctions are stored in the UClass.
UnLua will only use the first binding, other bindings will be ignored.
If you really need to do this, try generated different classes from the SpawnClass dynamically and then bind different lua modules to them. See my reply in #658
Hi,
The Dynamic Binding functionality is not working correctly anymore. For example, in this test, the code is selecting a random test module to bind to the BP_GravitySphere actor from the "DynamicBinding" tutorial.
The Test modules are just a simple print:
The expected behavior is, each time Left Mouse is pressed, a random Module is selected, bound to the spawned actor and function "Run" is done.
This is not the case, in all cases, the Spawn Actor will be bound to the first module that was bound each time the mouse is clicked:
The text was updated successfully, but these errors were encountered: