public static void Poll(Action<ModelJson> onProcessFinished, Action<string, string> onProcessFail, Action<string, string, int> onProcessPoll, string id, int timeout)
Parameters
Description
Allows you to poll for a model's current state in the Animate Anything processing pipeline. This polls continuously until the model either produces a failure or a successful result.
Example
publicclassMyTestScript:MonoBehaviour{string myModelID ="416e797468696e67476f6573";publicvoidPollMyModel() {AnythingAnimate.Poll( PrintDebugWhenSuccessful, PrintDebugWhenFail, PrintDebugWhenPoll, myModelID); } // This function will be invoked if the model has successfully been animated by Animate AnythingpublicvoidPrintDebugWhenSuccessful(ModelJson details) {Debug.Log("Model successfully animated!"); } // This function will be invoked if an error was encountered in animating the modelpublicvoidPrintDebugWhenFail(string code,string message) {Debug.Log("Could not animate model!"); } // This function will be invoked whenever the model is polled forpublicvoidPrintDebugWhenPoll(string code,string message,int seconds) {Debug.Log("Polling for update on my model!"); }}
Function asking the user what to do once the model has finished processing. ModelJson parameter contains the necessary details to create the model using AnythingMaker.Make.
onProcessFail
Function asking the user what to do if an error occurs whilst processing. First string parameter contains the error code. Second string parameter contains the error message.
onProcessPoll
Function asking the user what to do whilst processing. First string parameter contains the current output code. Second string parameter contains the message. The int parameter accounts for how many seconds the model has been processing for.
id
The ID of the model to poll.
(timeout)
The amount of time in seconds before the polling times out. Standard timeout is set to 10 minutes.