Forum begins after the advertisement:


Character Selector Different Skins

Home Forums Video Game Tutorial Series Creating a Rogue-like Shoot-em Up in Unity Character Selector Different Skins

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #11802
    Jeremy Lock
    Participant

    Hello,

    I have 2 different characters that look different but your character selector only implements the scriptable object. How can I make the characters also look different with animations etc not just the stats?

    #11806
    Terence
    Keymaster

    I’m not very clear about the inner workings of the Vampire Survivors series’ codebase, but generally speaking, if you want different animations for another character, you will have to create a different Animator Controller for the other character and prefab it.

    Let me know if that makes sense.

    #11809
    Xavier Lee
    Keymaster

    Hi Jeremy Lock, that’s an interesting question.

    It sounds to me that you want the sprite and animator controller to be different depending on which character is selected. This is a relatively straightforward process.

    1. First, you have to add a sprite and animator controller fields to the CharacterScriptableObject
    2. Then, when assigning the data in the PlayerStats, simply change the sprite and animator controller to that of the characterData‘s

    Hope this helps!

    #11866
    Windfinz
    Participant

    Hi Xavier Lee
    im currently having a problem with the second step of assigning the data to the PlayerStats script, could you send me a picture of the code?

    #11868
    Terence
    Keymaster

    Hi Windfinz, we post all our codes in the accompanying articles for each video. You can find a list of all the articles here: https://blog.terresquall.com/series/creating-a-rogue-like-vampire-survivors/

    #11951
    GrimMemento
    Silver Supporter (Patron)

    Nevermind

    #12135
    g Dni
    Silver Supporter (Patron)

    Hi Xavier Lee
    I have the same question. I make the prefabs of characters with different sprite and animation. Then i add the GameObject field of characters’ prefab to the characterScriptableObject. But it doesn’t work.

    #12137
    Terence
    Keymaster

    Hi g Dni, do you have screenshots / videos of the error(s) you are encountering?

    #12140
    g Dni
    Silver Supporter (Patron)
    
        void Awake()
        {
            ......
            currentSprite = characterData.Sprite;
            currentAnimatorController = characterData.AnimatorController;
        }
    
        void Start()
        {
            //Done
            transform.GetComponent<Animator>().runtimeAnimatorController = currentAnimatorController;
            Debug.Log("currentAnimatorController: " + currentAnimatorController);
            //not work
            transform.GetComponent<SpriteRenderer>().sprite = currentSprite;
            Debug.Log("sprite: " + currentSprite);
        }
    

    I followed the suggestions. It wokrs for changing animator, but not for sprite.

    #12141
    Terence
    Keymaster

    What does your Debug.Log("sprite: " + currentSprite); line print?

    #12153
    g Dni
    Silver Supporter (Patron)

    It print the exact sprite which i wanted. I found the problem caused by animator and i fixed it by adding the Idle animation.

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: