AnythingAnimate

AnythingWorld.AnythingAnimate

Static Methods

Description

A class that provides methods for interfacing with Animate Anything directly in Unity.

Example

public class MyTestScript : MonoBehaviour 
{
    string myModelPath = "C:\Users\User\Desktop\MyModel.fbx"
    string myExtraAssetsPath = "C:\Users\User\Desktop\MyModelAssets"

    string myModelName = "My Model";
    string myModelType = "Human";
    string authorName = "Model Author";
    string myModelLicense = "MIT";
    bool myModelSymmetry = true;
    bool myModelUsedForImprovement = false;

    private void Start() 
    {
        AnimateMyModel();
    }

    public void AnimateMyModel()
    {
        AnythingAnimate.Animate(
            myModelPath, 
            myExtraAssetsPath,
            myModelName,
            myModelType,
            authorName,
            myModelLicense,
            myModelSymmetry,
            myModelUsedForImprovement,
            PollMyModel,
            PrintDebugWhenAnimateFail)
    }
    
    // This function will be invoked if the model has successfully been sent to Animate Anything
    public void PollMyModel(string ID)
    {
        AnythingAnimate.Poll(
            PrintDebugWhenPollSuccessful,
            PrintDebugWhenPollFail,
            PrintDebugWhenPoll,
            ID);
    }
    
    // This function will be invoked if the model has successfully been animated by Animate Anything
    public void PrintDebugWhenPollSuccessful(ModelJson details)
    {
        Debug.Log("Model successfully animated!");
        AnythingMaker.Make(details);
    }
    
    // This function will be invoked if an error was encountered in animating the model
    public void PrintDebugWhenPollFail(string code, string message)
    {
        Debug.LogError("Could not animate model!");
    }
    
    // This function will be invoked whenever the model is polled for
    public void PrintDebugWhenPoll(string code, string message, int seconds)
    {
        Debug.Log("Polling for update on my model!");
    }
    
    // This function will be invoked if an error was encountered in sending the file to Animate Anything
    public void PrintDebugWhenAnimateFail(string ID, UnityWebRequest error)
    {
        Debug.LogError("Could not send model to be animated!");
    }
}

Last updated