Hey @Soeda, just wanted to keep you posted. We’re still looking into this issue - we’ve bumped this issue with our team to get a quicker response. Sorry for the delays.
It looks like the slider entity is not listening on the UiSliderBus when you send the events. There are a couple of reasons that this might happen.
One reason would be if the properties on the LuaScriptComponent are not set correctly. The “Slider” property needs to be set to point to an entity with a UiSliderComponent on it.
Assuming that is all setup correctly it could be a problem with the order in which the UI element entities are activated. If the element with this script on it is activated BEFORE the slider element then the slider will not be listening on the bus yet.
There are ways to safeguard for this. The recommended way is to use a TickBus to wait a frame before sending those events. So the steps are:
in the Activate register on the TickBus
In the OnTick method disconnect from the TickBus and then call the events on the Slider
This is a pattern that we use in a lot of our sample scripts to do something after all of the entities are activated. Since the script disconnects from the TickBus after the first frame there is no performance issue.
You can see an example of it in: SamplesProject\Scripts\UiMainMenuLuaSample\MainMenu.lua
function UIEditorLuaTutorial_Second:OnActivate()
self.tickBus = TickBus.Connect(self)
end
function UIEditorLuaTutorial_Second:OnTick()
self.tickBus:Disconnect()
UiSliderBus.Event.SetMinValue(self.Properties.Slider, 0)
UiSliderBus.Event.SetMaxValue(self.Properties.Slider, 360)
UiSliderBus.Event.SetValue(self.Properties.Slider, 0)