Example #1
0
    /// <summary>
    /// Gets the mesh from a gameobject.
    /// If no mesh is assigned to the mesh filter a new mesh will be created and assigned.
    /// If the mesh assigned to the mesh filter is shared, it will be automatically duplicated and the instantiated mesh will be returned.
    /// By using mesh property you can modify the mesh for a single object only. The other objects that used the same mesh will not be modified.
    /// [url]http://docs.unity3d.com/Documentation/ScriptReference/MeshFilter-mesh.html[/url]
    /// </summary>
    /// <returns>
    /// The mesh or null when no meshfilter available.
    /// Returns the instantiated Mesh assigned to the mesh filter.
    /// </returns>
    /// <param name='g1'>
    /// The game object
    /// </param>
    static public Mesh GetMesh(this GameObject g1)
    {
        MeshFilter mf = g1.GetComponent <MeshFilter>();

        return(mf.GetMesh());
    }