Search Unity

Need Suggestion on better way to make Customization

Discussion in 'Scripting' started by MrZeker, Sep 13, 2019.

  1. MrZeker


    Nov 23, 2018
    im trying to make a customization menu for my game, i have a base idea of what im going to do but, i wanna know if there is a better way to do it. I have around 100-120 meshes, with 250+ textures, for the clothing, so its a lot of things to do, and i dont want to hardcode it. Also im kind of a newbye on coding.
    What im thinking of doing is:
    Using two buttons (left/right), to add/substract from a list with the meshes, so in the menu you select "Torso", and there is a list/array, that displays only the "selected" mesh, when you click the buttons left/right it goes -1 or +1 on the position on the list/array.
    This seems easy, and i have on problem with it, however, the thing is, as the mesh changes, it also changes the textures and texture list. Im using only one texture per mesh,but for some meshes i have up to 5 variations, and for some only 2.
    So what i tought was using Scriptable objects, and make a SO for every "Item", containing one mesh, and all the textures for it, and when i swap the item, to instantly look in the "item" for the mesh and the texture list.

    But this is kind of a lot of work.
    is there any better way to do it? some simpler way?
    i would really appretiate some help here.
  2. Kurt-Dekker


    Mar 16, 2013
    Doing these sorts of customization systems are by definition "a lot of work."

    Your idea to data drive it all is an excellent instinct. ScriptableObjects and Prefabs are going to be your friend here.

    The ultimate success or failure will lie in how well you chop it up to suit the particular customizability in your game. Start small, customize ONE simple axis, such as swapping out the boots for instance, and don't customize anything else until you have that working flawlessly with an arbitrarily-sized collection of possible boots.

    Once you have it going, put it away for a week and come back to try and add another set of boots. Is it easy? Can it be easier?

    At that point you can reason about whether it is a worthwhile thing to pursue to completion, and what that might mean in terms of total work effort. It might also reveal a better way to do things, and it is always easier to rewrite a system that is only changes out the boots, for instance.