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
    Level 1
    Participant
    Helpful?
    Up
    0
    ::

    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
    Level 32
    Keymaster
    Helpful?
    Up
    0
    ::

    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
    Level 16
    Keymaster
    Helpful?
    Up
    0
    ::

    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.

    <ol> <li>First, you have to add a sprite and animator controller fields to the <code>CharacterScriptableObject</code></li> <li>Then, when assigning the data in the <code>PlayerStats</code>, simply change the sprite and animator controller to that of the <code>characterData</code>’s</li> </ol>

    Hope this helps!

    #11866
    Windfinz
    Level 1
    Participant
    Helpful?
    Up
    0
    ::

    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
    Level 32
    Keymaster
    Helpful?
    Up
    0
    ::

    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
    Level 17
    Former Patron
    Helpful?
    Up
    0
    ::

    Nevermind

    #12135
    g Dni
    Level 18
    Former Patron
    Helpful?
    Up
    0
    ::

    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
    Level 32
    Keymaster
    Helpful?
    Up
    0
    ::

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

    #12140
    g Dni
    Level 18
    Former Patron
    Helpful?
    Up
    0
    ::

    <pre><code> void Awake() { …… currentSprite = characterData.Sprite; currentAnimatorController = characterData.AnimatorController; }

    <code>void Start()
    {
        //Done
        transform.GetComponent&lt;Animator&gt;().runtimeAnimatorController = currentAnimatorController;
        Debug.Log(&quot;currentAnimatorController: &quot; + currentAnimatorController);
        //not work
        transform.GetComponent&lt;SpriteRenderer&gt;().sprite = currentSprite;
        Debug.Log(&quot;sprite: &quot; + currentSprite);
    }</code>

    </code></pre>

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

    #12141
    Terence
    Level 32
    Keymaster
    Helpful?
    Up
    0
    ::

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

    #12153
    g Dni
    Level 18
    Former Patron
    Helpful?
    Up
    0
    ::

    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: