Download

Dynamic animation blueprints?

In my GameMode subclass I intend to have a virtual function which does a chunk of per-level setup. One of the requirements is to have a radical different animation state machine between combat and exploration levels. How can I change the character anim bp in that method?

You can switch AnimInstance via the SkeletalMeshComponent on your character. You don’t (and probably shouldn’t) need to use your GameMode.

Ok… is that an aesthetic “shouldn’t” or a technical one? I have two sorts of levels that require different state machines. Sure I can duplicate my meshes and assign different AnimBPs to them, but that seems wasteful. Surely far better to use the instance of game rules to set up the per-level state machine?

I said that because I’m not sure what you mean by GameMode. In my mind, GameMode is supposed to hold game specific variables, not level specific. In Blueprint you can use:

void SetAnimInstanceClass(class UClass* NewClass);

from the SkeletalMeshComponent to change your AnimInstance dynamically. Does this make more sense?

The GameInstance is perhaps a better location for that? GameMode implements the rules of the game. If they change depending on the level, it needs subclassing?

Thanks, that looks like it’ll be useful!