public static GameObject GeneratePrimitive(Primitive type, Transform parent) { GameObject primitive; switch (type) { case Primitive.Cube: { primitive = GameObject.CreatePrimitive(PrimitiveType.Cube); primitive.transform.SetParent(parent, false); break; } case Primitive.Sphere: { primitive = GameObject.CreatePrimitive(PrimitiveType.Sphere); primitive.transform.SetParent(parent, false); break; } case Primitive.Capsule: { primitive = GameObject.CreatePrimitive(PrimitiveType.Capsule); primitive.transform.SetParent(parent, false); break; } case Primitive.Cylinder: { primitive = GameObject.CreatePrimitive(PrimitiveType.Cylinder); primitive.transform.SetParent(parent, false); break; } case Primitive.Quad: { primitive = GameObject.CreatePrimitive(PrimitiveType.Quad); primitive.transform.SetParent(parent, false); break; } case Primitive.Plane: { primitive = GameObject.CreatePrimitive(PrimitiveType.Plane); primitive.transform.SetParent(parent, false); break; } case Primitive.InvertedCube: { primitive = UnityClient.UserSession.Instance.GetInstance("Cubemap Video Display", parent); break; } case Primitive.InvertedSphere: { primitive = UnityClient.UserSession.Instance.GetInstance("Spherical Video Display", parent); break; } case Primitive.CurvedScreen: { primitive = UnityClient.UserSession.Instance.GetInstance("Standard Video Display", parent); break; } default: primitive = null; break; } if (primitive) { primitive.AddComponent <InstancedAssetWidget>(); } return(primitive); }