Forum rules - please read before posting.

How to define when to load character's animations

Hello,
I'm using AC 1.66.1 + Unity 2017.1.f1 for a 2d graphic adventure.

When I build I note that the first start of the game is quite slow. I tested some possible solutions and atlases help, but, the problem, I think, is that, at the first start, the game loads all the player'a animations (and so atlases): now I have about 30 custom animations for the main character and this is quite heavy to load (and when the games is finished I have about 70-80 custom animations).

Is there a way to load these animations, throught a script, when I really need them? For example, when the game starts, I need only the basic animations (Talk, Walk, etc, so I think the start game gets faster ), but when I load a new room I'd like to have the chance to load the custom animations for that room, and then, when I leave the room, to unload them.

Thank you

Comments

  • You can create a "local" Player for a scene that'll override the game's default. If there are a lot of Player animations specific to that scene, it might make sense to rely on a separate Player with his own Animator just for then.

    You can also make use of Timeline to play animations on your Player without need for them to be present on the Animator.

  • thank you very much Chris. I have to try the local Player. Actually I have a prefab on the root of my project, so he can load in every room. To create a local player that overrides the default is enought I copy the default player from the root into the scene? In this case I have to maintain the default animations (talk, take, idle, walk) for every "local" players plus the custom animation, while in the default player I have to delete the custom animations used in the "local" (I delete the custom animations from the player's animator tab): is it the correct workflow?

  • While I'd give some thought to using Timeline (though this is better suited to 3D than 2D), yes - that was the workflow I was suggesting for the local player method.

  • Thank you very much, Chris

  • Hi again Chris. I tried the workflow described, but maybe I make something wrong. I drag the Player prefab from the root to my scene, and this is ok, but, when I open the animator tab and delete one of the animations inside, it deletes the animations both in the "local" player and in prefab in the root, like if the two are linked. So I can't have splitted animations for the two (or more) players. Am I missing something?

  • I tried also with GameObject/Break Prefab Instance but it seems not to work.

  • Maybe I solved: I duplicated the animator controller and delete the status in the controller and seems to work. Then I applied the new controller to the local player. Is it correct?

  • Both the scene and prefab players have an Animator that relies on an Animator Controller, which is an asset file. Unless you duplicate it and assign each Player a separate asset, they'll both rely on the same one - so changes you make to one will be felt by the other.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.