Class PrimitiveBuilder
- Namespace
- S1MAPI.ProceduralMesh
- Assembly
- S1MAPI_Mono.dll
Helper for creating and configuring Unity primitive GameObjects Based on patterns from PetShopSpawner
public static class PrimitiveBuilder
- Inheritance
-
PrimitiveBuilder
- Inherited Members
Methods
CreateBox(string, Vector3, Vector3, Color, Transform?)
Create a box primitive (convenience method)
public static GameObject CreateBox(string name, Vector3 localPosition, Vector3 size, Color color, Transform? parent = null)
Parameters
namestringlocalPositionVector3sizeVector3colorColorparentTransform
Returns
- GameObject
CreateCylinder(string, Vector3, Vector3, Color, Transform?)
Create a cylinder primitive (convenience method)
public static GameObject CreateCylinder(string name, Vector3 localPosition, Vector3 size, Color color, Transform? parent = null)
Parameters
namestringlocalPositionVector3sizeVector3colorColorparentTransform
Returns
- GameObject
CreatePointLight(string, Vector3, Color, float, float, Transform?, LightShadows, LightRenderMode)
Create a point light with URP-correct defaults matching Schedule I's pipeline.
public static GameObject CreatePointLight(string name, Vector3 localPosition, Color color, float range, float intensity, Transform? parent = null, LightShadows shadows = LightShadows.None, LightRenderMode renderMode = LightRenderMode.ForcePixel)
Parameters
namestringGameObject name
localPositionVector3Local position relative to parent
colorColorLight color
rangefloatLight range in meters
intensityfloatLight intensity
parentTransformOptional parent transform
shadowsLightShadowsShadow mode (default: None to match game's URP settings)
renderModeLightRenderModeRender mode (default: ForcePixel for URP per-pixel lighting)
Returns
- GameObject
CreatePrefab(string, string, Vector3, Quaternion, Transform?)
Create a prefab instance from a loaded resource or existing object
public static GameObject CreatePrefab(string prefabName, string name, Vector3 localPosition, Quaternion localRotation, Transform? parent = null)
Parameters
prefabNamestringName of the prefab to find/load
namestringName for the instance
localPositionVector3Local position relative to parent
localRotationQuaternionLocal rotation
parentTransformOptional parent transform
Returns
- GameObject
The created GameObject instance or null if not found
CreatePrimitive(PrimitiveType, string, Vector3, Vector3, Color, float, Transform?)
Create a primitive with scaled dimensions
public static GameObject CreatePrimitive(PrimitiveType type, string name, Vector3 localPosition, Vector3 localScale, Color color, float scale, Transform? parent = null)
Parameters
typePrimitiveTypeThe type of primitive to create
namestringName for the GameObject
localPositionVector3Local position relative to parent
localScaleVector3Local scale
colorColorBase color for the material
scalefloatGlobal scale multiplier
parentTransformOptional parent transform
Returns
- GameObject
The created GameObject
CreatePrimitive(PrimitiveType, string, Vector3, Vector3, Color, Transform?)
Create a Unity primitive GameObject with material and optional parent
public static GameObject CreatePrimitive(PrimitiveType type, string name, Vector3 localPosition, Vector3 localScale, Color color, Transform? parent = null)
Parameters
typePrimitiveTypeThe type of primitive to create
namestringName for the GameObject
localPositionVector3Local position relative to parent
localScaleVector3Local scale
colorColorBase color for the material
parentTransformOptional parent transform
Returns
- GameObject
The created GameObject
CreateSphere(string, Vector3, float, Color, Transform?)
Create a sphere primitive (convenience method)
public static GameObject CreateSphere(string name, Vector3 localPosition, float radius, Color color, Transform? parent = null)
Parameters
Returns
- GameObject
SetupMaterial(Renderer, string, Color)
Setup material for a renderer based on the object name and color Automatically determines if the material should be transparent (glass/window)
public static void SetupMaterial(Renderer renderer, string name, Color color)
Parameters
rendererRendererThe renderer to configure
namestringName of the object (used to determine material type)
colorColorBase color