Hey, I’d like to change the atlas that my sprite is using. And I’ve been following this example: https://www.defold.com/ref/sprite/#texture0 this is my code:
local function changeSprite (self, index)
local oldAddress = go.get("#sprite", "texture0")
pprint("Old address"..oldAddress)
local buffer = resource.load(oldAddress)
local newPath = atlasAddresses[progressionTables.skinReference[index].atlas]
resource.set(newPath, buffer)
go.animate("#sprite", "play_animation", {id = hash(progressionTables.skinReference[index].texture)})
end
I seem to get an error at line ‘local buffer = resource.load(oldAddress)’, the error is “bad argument #1 to ‘load’ (string expected, got userdata)”. Am I doing something wrong? Did texture0 value type changed, somewhere along the way? What would be the way to change the atlas now?