Search Unity

Wondering about resource management for sprites and animation controllers

Discussion in '2D' started by MagicCancel, Mar 23, 2016.

  1. MagicCancel

    MagicCancel

    Joined:
    Jul 30, 2015
    Posts:
    25
    Hello all, I am making a sprite based brawler that involves a character power-up-mode mechanic.

    Basically, at the press of a button, the character can transform into a powered up mode. I am currently doing this by just changing the animation controller attached to the animator component using Resources.load from script.

    I am not familiar with how Untiy handles loading up sprite resources an before I go further I was wondering if anyone had any insight into this. Is this woefully inefficient and will cause slow down? Or am I on the right track?

    Any information is appreciated, so thanks in advance to any response.
     
  2. tidyui

    tidyui

    Joined:
    Mar 13, 2016
    Posts:
    8
    Well Resources.load and instatiate usually is a bit slow. My suggestion is that you
    1. For the character AnimationController, create a new power-up layer
    2. Make this layer sync with the main layer so that all states are just copied into the new layer
    3. Then just change the animations for the states in this layer to your powered-up character
    After this is done you can just switch active animation layer from your character script without having to load additional resources or changing the game object.

    Regards
     
    LiterallyJeff likes this.