Jump to content

Recommended Posts

1 hour ago, Hiru315 said:

I want to reskin multi items and their inventoryimages.


Do I need to get every prefab file of each item and edit the code to load new xml/tex images?
or just need to replace only the game's inventoryimages1-2-3?

Sorry if this has been asked.

The optimum thing to do is not replace the inventoryimages files as that is prone to issues with future updates but instead to use something like this

To simply override the path to those textures, you don't need to update any prefabs this way as anything that references those images will properly use the new images.

local Image = require("widgets/image")
local _SetTexture = Image.SetTexture
Image.SetTexture = function(self, atlas, tex, ...)
  local rule = {
    --atlas1={texture1={atlas2,texture2}}
    "inventoryimages1.xml"={"xxx.tex"={"yours.xml","yyy.tex"}}
  }
  if rule[atlas] and rule[atlas][tex] then atlas, tex = unpack(rule[atlas][tex]) end
  return _SetTexture(self, atlas, tex, ...)
end

CunningFox's method

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...