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 script 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.
Public Methods
// Essential methods for scripts that inherit from this class

// 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)

// Public methods

// Change current geometry resolution
public void MDGeometryBase_ChangeResolution(float res)
// Change current geometry center-feature
public void MDGeometryBase_ChangeMeshCenter(bool centerGeo)
// Flip/reverse mesh faces/triangles
public void MDGeometryBase_FlipTriangles()
Public Fields and Properties
public int geometryResolution = 1;
public bool geometryUseResolution = true;
public bool geometryCenterMesh = true;
public Vector3 geometryOffset = Vector3.zero;

public bool IsInitialized { get; }

public string GeometryName { get; }

public MDVertices GeometryVertices { get; }
public MDTriangles GeometryTriangles { get; }
public MDUvs GeometryUVs { get; }
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(Advanced 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 just:
  // 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>();
 }
}