[Video][Unity Tutorial] Character Customization Menu

 

This is the file: Link  for the spritesheet!

Alternatively: RobinTutorialSS

 

All right everyone! Here’s what happened in that tutorial, sorry for the delay in writing this, I was having some of a writer’s block.

 

  • At first, we created a canvas with all the components we’ll need, which are mostly text components, a few buttons and an image. This image is our placeholder for our character’s 00 sprite.
  • Next, we import the spritesheet, set the options to: Point, Truecolor, Multiple, and maybe the max size to 128 if you’re feeling bold. In any case, you have to enter the sprite editor after applying these changes.
  • In there, slice automatic but change the names of the sprites to xxx_00 to 22, depending on position. This will help later.
  • After this is all set up, it’s time to create a Customization script, which contains the functions for the buttons.
  • The main point of this tutorial is to show you about the Resources folder and its scripting so just get to that!
  • Now, each button will cycle through the pictures in the spritesheet. Color is assigned to one of the ints right after the sprite’s name, as is Hair.  This way when we click button we stay on the same color scheme, but the hair changes, and the other way for color!
  • This method is practically cheating, but it’s a clean way to do character customization. I’d recommend it for many things since you can save the selections in a variable.

 

Now, for the second video, what happens is:

  • We create a Player script
  • Some texts are added as needed
  • We find those texts in the script so we can modify them
  • In the same script and the player script, some variables are created for each type of stat point
  • Afterwards, a function is created that asks the button, which stat do you handle mate? And then the button tells the function and the function adds the point wherever needed.
  • Lastly, we create the function that will spawn our character. This is not a character spawned from a prefab, but a character that only exists from code. So we add each component manually and in the end, it all works out.

I’ll copy the code right here, why? Because this is the first tutorial I’m able to record in one try. I’m really proud. Here you go, all the customization script is right here:

 

 

No wait that is kind of dumb. I’ll do a pastebin. Here’s the LINK.

 

Thanks for reading / watching!

Share

Leave a Reply

Your email address will not be published. Required fields are marked *