Class ModMesh
A mesh mod resource.
Inherited Members
Namespace: Modding
Assembly: Assembly-CSharp.dll
Syntax
public class ModMesh : ModResource
Properties
Error
Declaration
public override string Error { get; }
Property Value
Type | Description |
---|---|
String |
Overrides
HasError
Declaration
public override bool HasError { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
Loaded
Declaration
public override bool Loaded { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
Mesh
Declaration
public Mesh Mesh { get; }
Property Value
Type | Description |
---|---|
UnityEngine.Mesh |
Methods
SetOnObject(GameObject, MeshReference, Action<GameObject>, Action)
SetOnObject is a utility method that easily allows handling long resource loading times. This overload also sets the transform values of a MeshReference.
Declaration
public void SetOnObject(GameObject go, MeshReference r, Action<GameObject> postSetAction = null, Action prefabPostSetAction = null)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.GameObject | go | Object on which to set the resource. |
MeshReference | r | MeshReference whose transform values should be set. |
Action<UnityEngine.GameObject> | postSetAction | Callback for every object that is set. |
Action | prefabPostSetAction | Callback for the original object. |
Remarks
When SetOnObject is called on an object, an OnLoad handler for the resource is installed that will automatically set the appropriate value (renderer.material.mainTexture for a ModTexture, meshFilter.mesh for a ModMesh, and audioSource.clip for a ModAudioClip) when the resource is done loading.
However, the major benefit of using SetOnObject is that it will also automatically handle the given GameObject being instantiated/copied. All instances of the object will also automatically receive the resource.
The two optional callbacks can be used to perform additional actions that are necessary to correctly set the resource. The first one is called for every object on which the resource is set (including the original object), and the second one only for the object originally passed into the function.
In this overload, an additional MeshReference object is passed in. Its transform values (Position, Rotation, Scale) will also automatically be set, in addition to the mesh.
Operators
Implicit(ModMesh to Mesh)
Declaration
public static implicit operator Mesh(ModMesh mesh)
Parameters
Type | Name | Description |
---|---|---|
ModMesh | mesh |
Returns
Type | Description |
---|---|
UnityEngine.Mesh |