βοΈMake
AnythingWorld.AnythingMaker.Make
Declaration
public static GameObject Make(string name)
public static GameObject Make(string name, params [] parameters
Parameters
name
Name of model to request from database with or without GUID qualified. (eg. fox, cat#0001)
parameters
Optional list of request parameters (see: RequestParameter) to apply to this request, override default parameters.
Description
This method allows users to request an object from the Anything World database and have it instantiated in the scene according to the parameters they pass in. If no parameters are passed in the default parameters will be used.
Users can provide RequestParams, that can be created using the RequestParameter class.
Example
//Creates a cat with some parameters.
public class MakeACreature : MonoBehaviour
{
public void MakeACat()
{
AnythingMaker.Make("cat",
//Will add animation system if available
RequestParameter.IsAnimated(true),
//Sets position to zero
RequestParameter.Position(Vector3.zero),
//Adds default behaviours from preset
RequestParameter.SetDefaultBehaviour(),
//Set callbacks for successful creation.
RequestParameter.OnSuccessAction(PrintDebugWhenSuccessful),
//Set callback for failed creation.
RequestParameter.OnFailAction(PrintDebugWhenFail),
//Add another example script
RequestParameter.AddScripts(typeof(UserScriptExample)));
}
// This function will be invoked if model creationg process successful
public void PrintDebugWhenSuccessful()
{
Debug.Log("Finished making model!");
}
// This function will be invoked if the model creation process fails
public void PrintDebugWhenFail()
{
Debug.Log("Could not finish making model!");
}
}
Last updated
Was this helpful?