This is the main code I use to instantiate a prefab. I have an empty w/ a box shape attached to it. The prefab is linked from the project explorer (i.e.-drag/dropped into the GameObject public variable),
Prefab instantiate code,
public void SpawnPrefab()
{
Vector3 position = new Vector3(Random.Range(collider.bounds.min.x,collider.bounds.max.x),
Random.Range(collider.bounds.min.y,collider.bounds.max.y),
Random.Range(collider.bounds.min.z,collider.bounds.max.z));
GameObject theObject = (GameObject)Instantiate(prefab, position, Quaternion.identity);
}
On another gameobject/script, I play a blend animation with this code,
skinnedMeshRenderer.SetBlendShapeWeight(blendStateIndex, blendShapeAmount);
The problem is, once I do this, no matter how many prefab clones I have, if I raycast/hit one object, the blend shape plays on ALL of the clones, though I only want it to play on one.
Do I need to instantiate the mesh alone or something?