So, I’m trying to change this component in C#. But don’t fully understand how.
I tried this:
playerGraphics.GetComponent().sharedMesh = blueDressMesh.sharedMesh;
But it gives a strange error… (Array index (0) is out of bounds (size=0) unity)
So, I’m trying to change this component in C#. But don’t fully understand how.
I tried this:
playerGraphics.GetComponent().sharedMesh = blueDressMesh.sharedMesh;
But it gives a strange error… (Array index (0) is out of bounds (size=0) unity)
well basically you need to set there a mesh.
accusing the SMR is this:
Mesh myMesh;
SkinnedMeshRenderer smr = transform.GetComponent<SkinnedMeshRenderer>();
smr.sharedMesh = myMesh;
Mesh myMesh can be everything, you can set it as a public Property, or you can search for a mesh in a GameObject, something like this:
public GameObject myGameObject;
myMesh = myGameObject.GetComponent<MeshFilter>().sharedMesh;