MD Package Technical & APi Documentation
MD_GeometryBase :: MD_MeshBase
Namespace: MDPackage.Geometry
Base geometry class for all the geometry-related instances. Implement this base class to any class that will constantly work with Unity-meshes and frequent updates will be necessary.
Please read the APi below carefully as the setup for classes that inherit from this base class is slightly different.
Properties
public bool IsInitialized { get; }

public string GeometryName { get; set; }

// Display the 'resolution' field in the inspector? Is the default geometry resolution field even used for the inherited object?
public bool GeometryUseResolution { get; set; }
public int GeometryResolution { get; set; }
public bool GeometryFlipTriangles { get; set; }
public bool GeometryCenterMesh { get; set; }
public Vector3 GeometryOffset { get; set; }

public MDVertices GeometryVertices { get; }
public MDTriangles GeometryTriangles { get; }
public MDUvs GeometryUVs { get; }
Public Methods
// Create a new geometry instance of a specific type
public static T CreateGeometry<T>(GameObject entry, bool updateJustOnce = true)

// Create a new geometry instance of a specific type, process calculations just once and remove the component. This will leave just a complete mesh on the object in one frame
public static void CreateGeometryAndDispose<T>(GameObject entry, string geometryName = "NewGeometryMesh")

// Create a new geometry instance of a specific type, process calculations just once and remove the component. This will return a completely new gameObject with a mesh in one frame
public static GameObject CreateGeometryAndDispose<T>(string gameObjectName = "NewGeometryObject", string geometryName = "NewGeometryMesh", bool prepareMaterial = true)

// Prepare a created geometry instance with material in the scene. Ignore advanced params if not in the editor
public static GameObject PrepareGeometryInstance(GameObject sender, bool selectAndJumpToCamera = true)
Examples & Setup
All the geometry that inherit from this base class must be initialized in a certain way.
You can either simply call gameObject.AddComponent() or call a static method MD_GeometryBase.CreateGeometryAndDispose(custom data...).
using UnityEngine;

using MDPackage.Geometry;

public class SampleScript : MonoBehaviour
{
// Use the cone for further modification
private MDG_Cone cone;

private void Start()
 {
  // Create a cone geometry just once - this will add a MDG_Cone script to this object and will remain
  cone = MD_GeometryBase.CreateGeometry<MDG_Cone>(gameObject);
  // Or:
  // cone = gameObject.AddComponent<MDG_Cone>();
 }
}
The gameObject that receives this geometry does not need to have MeshFilter/MeshRenderer, this is handled automatically. However the materials will be empty.

If you would like to add a certain geometry script without using the actual script and only generate a mesh, you can use CreateGeometryAndDispose static method.
using UnityEngine;

using MDPackage.Geometry;

public class SampleScript : MonoBehaviour
{
private void Start()
 {
  // Create a cone geometry just once - this will add a MDG_Cone script to this object, generate the cone mesh and remove the script afterwards
  // So the only mesh will remain
  MD_GeometryBase.CreateGeometryAndDispose<MDG_Cone>(gameObject);
 }
}
Another way of adding the geometry and disposing the script is to create a brand new gameObject.
using UnityEngine;

using MDPackage.Geometry;

public class SampleScript : MonoBehaviour
{
private void Start()
 {
  // Create a cone geometry just once on a new gameObject - this will create a new gameObject,
  // add a MDG_Cone script to the new gameObject, generate the cone mesh and remove the script afterwards
  // So the only mesh will remain
  GameObject newGm = MD_GeometryBase.CreateGeometryAndDispose<MDG_Cone>();
 }
}