Answered

Any way do keep project open after enter playmode

Invector 11 months ago updated by Peter - Soxware Developer 11 months ago 7

Love this tool but it's so annoying to keep reopening the project and assigning the object to animate after I enter play mode to test the animation, this workflow is really slowing me down.

UMotion Version:
Unity Version:

Answer

Answer
Answered

Hi,
thank you very much for your support request.

You could use the UMotion API (see documentation). It provides methods to open a sepcific UMotion project and also to assign a GameObject to the pose editor. Something like this should work (written out of my head):


using UnityEditor;
using UnityEngine;
using UMotionEditor.API;

public class MyUMotionExtension
{
   [MenuItem("Window/Open My UMotion Instance")]
   private static void OpenMyUMotionInstance()
   {
      ClipEditor.LoadProject("Assets/umotion_project.asset"); // <-- insert the correct path. Path must be relative to Unity's project directory.
      GameObject animatedGameObject = GameObject.Find("MyCharacter"); // <-- insert name of your character
      PoseEditor.SetAnimatedGameObject(animatedGameObject);
   }
}

A clean and universally working solution has proven to be very difficult to implement in UMotion.

Please let me know in case you have any follow-up questions.

Best regards,
Peter

Answer
Answered

Hi,
thank you very much for your support request.

You could use the UMotion API (see documentation). It provides methods to open a sepcific UMotion project and also to assign a GameObject to the pose editor. Something like this should work (written out of my head):


using UnityEditor;
using UnityEngine;
using UMotionEditor.API;

public class MyUMotionExtension
{
   [MenuItem("Window/Open My UMotion Instance")]
   private static void OpenMyUMotionInstance()
   {
      ClipEditor.LoadProject("Assets/umotion_project.asset"); // <-- insert the correct path. Path must be relative to Unity's project directory.
      GameObject animatedGameObject = GameObject.Find("MyCharacter"); // <-- insert name of your character
      PoseEditor.SetAnimatedGameObject(animatedGameObject);
   }
}

A clean and universally working solution has proven to be very difficult to implement in UMotion.

Please let me know in case you have any follow-up questions.

Best regards,
Peter

Thanks that actually help a lot to improve the workflow!

To make this solution more generic, you could create a floating window similar to the muscle groups that is only visible if the Clip Editor is selected without a project open, this window can be assigned with the uMotion.asset and the gameobject for a quick re-open.

Glad to hear that this helps.

Thanks for sharing your idea. I'm going to consider something like this for a future update.

Best regards,

Peter

I actually create a little extension for me, but feel free to use any of this code :)

UQuickOpen

Before It was required 6 steps everytime I exit playmode to get back working on animations:

1- Click on ClipEditor tab 

2- Click on File

3- Go to Recently Open Projects

4- Click on my uProject

5- Find my Character on the Hierarchy

6- Assign to the GameObject field on the Pose Editor

Now, assign just once the uProject and Character model into the fields with 1 click it opens everything for you :)

The workflow is quite improved now ^^

Cheers, 

Invector Team

Hey,

thank you so much for sharing your script. I'm pretty sure it might be helpful for others as well.

Btw. the UMotion API is getting a big update in the upcoming UMotion release (coming this week). The new API let's you add buttons to the pose editor and menu items to the clip editor. It also let's you interact with the pose of the character and allows you to create key frames. Might be worth checking out in case you have other workflow situations you want to improve by custom extensions :-)

Best regards,
Peter

Nice! will sure update when you released ;)