Forum rules - please read before posting.

How can I integrate UMA2 animator to AdventureCreator PlayerAnimator?

Hey guys, I'm working on a project with UMA2 and AC.

UMA2 generates characther model at run time, but Adventure Creator needs that player be set as prefab on scene begin. Well, I'm setting a player prefab with just the basic AC needs on the scene begin and also generating the UMA characther as a player child.

The problem is that while the changes on parameters affect the player animator, his UMA characther son, that haves the same animator controller, is not sharing the same state of his parent. I tried this code that doesn't solve the problem, but that can give you an idea of what I'm up to.
image
One of the possible solutions could be create a prefab for the UMA characther and use switch characther action. In this case, I can't, the game will have a screen to generate chracthers and there is no way to do a prefab logic with things being created at runtime.

So I need something that makes the UMA characther receive the same animator parameters changes that player haves during input.

Thanks in advance.image

Comments

  • edited October 2016
    Ummm.. that prefab wrapper idea feels a bit off to me... have you though of generating the character(Player) entirely at runtime? it may be a little more lengthy piece of code, and you may end up needing to pause or delay AC for a moment to avoid issues. But you could very well create the UMA character, then assign it the proper animator (from resources - Resources.Load), start doing GameComponent.AddComponent to add the AC Player script and the Paths scripts on the UMA character and then just set the properties/fields on both of those scripts (like the walk and run speed, etc). 

    It will probably be a more lengthy piece of code because you'll have to setup all of the AC scripts' fields and properties manually in the script, but it should be pretty straightforward to do too. My only fear is I don't know how fast AC notices that a player character isn't there or not (and it might assume there's no Player if it detects none before your script is done), that's why I said you may need to put AC to sleep for a moment while you "build" the player, but I'm not really sure if it will actually be needed. I would also recommend to make the Character a non-destroyable singleton so you don't have to redo the process on every scene.

    In this case, it would probably be a good idea to build the Player in the start screen/character building screen (always as a non-destroyable singleton), so that it's ready for regular gameplay when you get into a regular scene. Also remember you can manually place a "Player" on the scene, it doesn't need to be a prefab at all, as long as the object has the right scripts. As far as I know you could even leave the list of players in the Settings Manager blank and it shouldn't be much of a problem. 
  • Welcome to the community, @kelvingamedev.

    Another thing you could try is to do without runtime-instanciation of your Player prefab, and just rely on local Player objects in your scene.  While AC will normally load in whatever Player you've assigned in your Settings Manager when your game begins, it will always look to see if there's a local Player in the scene beforehand.

    This allows you to override your prefabbed Player for specific scenes, but if you have a local Player in each of your game's scenes, you can do without an instantiated Player prefab entirely.
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.