static Asset CreateModelFromPolygonMeshes( Sandbox.PolygonMesh[] polygonMeshes, string targetAbsolutePath )

robot_2Generated
code_blocksInput

Description

The CreateModelFromPolygonMeshes method in the Editor.EditorUtility class is a static method used to create a model asset from an array of polygon meshes. This method is particularly useful for developers who need to programmatically generate models from mesh data within the s&box environment.

Usage

To use the CreateModelFromPolygonMeshes method, you need to provide an array of PolygonMesh objects and a string representing the target absolute path where the model asset will be saved. The method returns an Editor.Asset object representing the newly created model.

Example

// Example usage of CreateModelFromPolygonMeshes

// Assume polygonMeshes is an array of PolygonMesh objects
PolygonMesh[] polygonMeshes = GetPolygonMeshes();

// Define the target path where the model will be saved
string targetPath = "C:/Models/MyModel.asset";

// Create the model from the polygon meshes
Editor.Asset modelAsset = Editor.EditorUtility.CreateModelFromPolygonMeshes(polygonMeshes, targetPath);

// Use the modelAsset as needed
// For example, you might want to add it to a scene or perform further operations