Skip to content

[Muli-Skin] dynamically build Texture2Ds #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

zaneclaes
Copy link

@zaneclaes zaneclaes commented Nov 3, 2017

This is still a WIP

I have all the code working to allow for swapping of equipment and base skins. The developer can customize it any which way by creating a single "regions" JSON file (see attached). This is just a bunch of named rectangles, like "helmet" and "face" in the attached example. Then, the developer can use the new "Creature Material Packer" script I built by assigning a default material, an array of skins, and the regions JSON file. Finally, when the developer wants to actually swap something, it's as simple as SetAttachment("helmet", "Equip_Silver") or SetAttachment("face", "Skin_Pale") to continue with our example.
screen shot 2017-11-04 at 9 11 49 am

I optimized the code a bit so it always does incremental asset-building. That is: it caches the last texture for any given Creature, only edits the texture when something changes, and does so incrementally such that it only copies the changed asset. I've got it building for iOS and so far the performance looks good. I tested this by having it swap the helmet between bronze & silver every 0.2 seconds in order to simulate a player rapidly equipping and unequipping items.
img_5267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant