Leonidas IV Posted January 6, 2022 Share Posted January 6, 2022 Basically I'm trying to port the loading screens to DS, but I'm having problems applying assets. When printing the Assets table, it is possible to see that my asset (Wilson) is registered, but for some reason I still have errors. [Others Assets...] [00:06:00]: ../mods/Nightmaer HUD/modmain.lua(50,1) ATLAS [00:06:00]: ../mods/Nightmaer HUD/modmain.lua(50,1) loading_images/wilson.xml [00:06:00]: ../mods/Nightmaer HUD/modmain.lua(50,1) IMAGE [00:06:00]: ../mods/Nightmaer HUD/modmain.lua(50,1) loading_images/wilson.tex [00:06:00]: LOADING LUA SUCCESS [00:06:00]: WARNING! Invalid resource handle for atlas '../mods/Nightmaer HUD/loading_images/wilson.xml', did you remember to load the asset? The .tex and .xml files are in the folder in question, everything looks correct. Here is the code. I didn't create the Assets variable here because I use it first in another location. local load_backgrounds = {"wilson"} if not Assets then Assets = {} end for _, image in pairs(load_backgrounds) do table.insert( Assets, Asset("ATLAS", "loading_images/" ..image.. ".xml")) table.insert( Assets, Asset("IMAGE", "loading_images/" ..image.. ".tex")) end local Image = require "widgets/image" AddGlobalClassPostConstruct("widgets/loadingwidget", "LoadingWidget", function(self) local random_image = math.random(#load_backgrounds) or 1 local atlas = "loading_images/" ..load_backgrounds[random_image].. ".xml" self.bg = self:AddChild(Image(atlas, load_backgrounds[random_image].. ".tex")) self.bg:SetVRegPoint(_G.ANCHOR_MIDDLE) self.bg:SetHRegPoint(_G.ANCHOR_MIDDLE) self.bg:SetVAnchor(_G.ANCHOR_MIDDLE) self.bg:SetHAnchor(_G.ANCHOR_MIDDLE) self.bg:SetScaleMode(_G.SCALEMODE_FILLSCREEN) end) I made it dynamically to facilitate the registration of multiple load_backgounds. However, I've already tried to do it the traditional way and it didn't work either... Thanks for any help. Link to comment https://forums.kleientertainment.com/forums/topic/136749-assets-issue/ Share on other sites More sharing options...
Leonidas IV Posted January 7, 2022 Author Share Posted January 7, 2022 I found a solution... I had to use a delay with DoTaskInTime so that the asset has time to load. Link to comment https://forums.kleientertainment.com/forums/topic/136749-assets-issue/#findComment-1531091 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now