Character Customization Using Spritesheets - Unity Tutorial

preview_player
Показать описание

NOTE: The gameobject already has an idle animation set up with the spritesheet named 'HamsterMain'. This loops through the frames: HamsterMain_0, HamsterMain_1, HamsterMain_2, HamsterMain_3.

In this Unity tutorial we will be setting up character customization using spritesheets, animations included. This does NOT make use of a rigged/skeletal character, but actual frame by frame hand drawn animations.

Other helpful videos on character customization in Unity:
• If you're looking for character customization for skeletal/rigged animation (2D CHARACTER CUSTOMIZATION in Unity Tutorial - BM0):
• For 3D character customization (3D CUSTOMIZATION MENU IN UNITY - TUTORIAL - Blackthornprod):
• Making your own spritesheets (HOW TO MAKE SPRITE SHEETS FOR YOUR UNITY GAME - TUTORIAL - Blackthornprod):
• Basic 2D character customization including color changing (2D CUSTOMIZATION MENU IN UNITY - TUTORIAL - Blackthornprod):
• Simple skin/character selection menu (UNITY SKIN/CHARACTER SELECTION/CUSTOMISATION MENU EASY TUTORIAL - diving_squid):

#unity #gamedev #devlog #indiedev #tutorial
Рекомендации по теме
Комментарии
Автор


Also if you are learning and do copy paste the scripts over, make sure you understand what is written in them. Next to that, the main CustomizableCharacter.cs script is slightly adjusted from the video to make it easier to add accessories with the other script in the pastebin called CustomizableAccessories.cs. The comments in both scripts respectively explain more.

GoldenEvolution
Автор

Here is a very important bit of information that will make this click for anyone who doesn't get how this works.

The animation frames in Unity overwrite the sprite in Sprite Renderer component (spriteRenderer.sprite) at runtime and they also change the name of it (spriteRenderer.sprite.name) with the name of the actual image used for the frame in the animation.

If you put a Debug.Log on the Update function and put (spriteRenderer.sprite.name) inside the brackets you will see the name be updated in real time.

This is why it's possible in LateUpdate to override whatever the animation has put inside by checking the number in the image that is being used in this frame and just exchange it for whatever new sprite with the same number you want to put in there.

Thank you for this video, took really long to understand how to do this in a neat way, but I believe I have it figured out now!

aftalyfe
Автор

Besides the system relying on naming convention and parsing, I think this is absolutely genius.

robkiller
Автор

This video saved my ass, I couldn't find any good tutorials on this anywhere, thanks!!!

kaneaustin
Автор

How does this work in regards to if an Idle sprite switches to a Run sprite in the Animator? Right now it switches the Idle sprite, but it doesn't set the Run sprite to coincide with the skin change. The Idle/Run are both used on one player object. How would switch all relevant sprites (Run, Jump, Idle, etc) to the new versions at the same time?

WhiteRockManGameThing
Автор

Thanks. This is the beginning of what i needed. I'd replace the string.Replace for a string.Split("_") to avoid hard coding when possible. It makes it easier to adapt for addition customization options like hair, clothing, etc.

codytaylor
Автор

Very cool tutorial - i have a question about the accessories : do you have a spritesheet for the accessoir which has the certain height so that it act as an overlay ? or do you have made idle animation for every accessoirs with the hamster ?

whorubeta
Автор

How could i make this work for more than just the idle animation?

A_Generic_Duck
Автор

dude you save my life in 5 minutes acct 3 min i was already saved

brunosoares
Автор

Just a dumb question from someone just learning, how would I adapt this to multiple animations, as in movement up, down, left, right? Also with 2 sprite sheets for walking and horseriding.

blebleble
Автор

Awesome stuff! Definitely will be doing some character customization eventually. Thanks for sharing!!

WannibeManisha
Автор

Very nice video Golden! Never knew I had to learn how to change skins for a character, but the hamsters convinced me! Came for the hamsters, stayed for the tutorial! :D

alexneagu
Автор

Thanks! I really needed something like this

candylide
Автор

You're a legend! Was looking everywhere for something like this, thanks for sharing <3 Subbed

KathieHere
Автор

Will the skins stay even if I switch scenes?

Cenji
Автор

Awesome tutorial! Exactly what I was looking for and so simple and easy to maintain! Thanks a lot!

simonschmid
Автор

Did you do all the frame by frame animations in the character?

Sirandy
Автор

I want to do this but without the animation frames, just one. Can you help me please?

compulsive
Автор

Can you add accessories on animated character for example rigged one? meaning When animation is being played characters components transform and rotation do not change, is it possible to take animation component's animated transform position and rotation and use that exact position to animate attachments overlay on a character's head such as glasses?

Elguja
Автор

do we have to add an example of blue, green ? or if you have finished coding, the color will automatically change? hehe such as adding a green character sprite or something else?

ennizodev
join shbcf.ru