I have a canvas that I am using as a loading screen of sorts (I am aware that Lumberyard has this functionality built in, and I didn’t like it…there is a black screen for approximately 5 seconds as the engine switches from the loading canvas to the main level). From my understanding, this is accomplished using this line:
I have this line in the OnActivate() function on a script at the root of the UI canvas. The full code there is as follows:
function canvasUnloadOnSignal:OnActivate() GameLogger.LogInfoUrgent("Keeping level: " .. tostring(self.Properties.canvasName) .. " loaded on new level load.") UiCanvasBus.Event.SetKeepLoadedOnLevelUnload(self.entityId, true) local id = GameplayNotificationId(EntityId(), "CanvasUnloader_"..tostring(self.Properties.canvasName), typeid("string")) self.eventConnection = GameplayNotificationBus.Connect(self, id) end
(GameLogger logs the given string to a file) I can confirm that this is being called before the level is changed, and when I print out the value in the OnDeactivate() function it returns true.
Am I doing something wrong here? There is <1 second between the time that I set this flag and the level getting unloaded.