static void Create() { GameObject gameObject = new GameObject("Gear"); GFGear g = (GFGear)gameObject.AddComponent(typeof(GFGear)); GFGearGen gg = (GFGearGen)gameObject.AddComponent(typeof(GFGearGen)); MeshFilter meshFilter = (MeshFilter)gameObject.GetComponent(typeof(MeshFilter)); meshFilter.mesh = new Mesh(); gg.Rebuild(); gameObject.GetComponent <Renderer>().material = new Material(Shader.Find("Diffuse")); if (g.DrivenBy == null) { gg.alignTeethWithParent = false; gg.alignRadiusWithParent = false; } GFGearGenEditor.Persist(gg); }
void UndoCallback() { gearGenObject.Rebuild(); }