Hello, everyone!
I proceed my own mesh, and I want it interactable. But when I add a AddComponent(); in the code, it doesn’t work in the game.
If during the game I turn off and turn on the component again in the inspector panel, it works as needed.
Please, help me. I don’t understand, why it happens.
P.S. Blue circle is gaze and surface collide feedback from HoloToolkit for Mixed Reality.
P.P.S. I create GameObject, create surface and add mesh collider as GameObject.AddComponent();
EDITED
GameObject go= new GameObject(name);
go.transform.SetParent(parent.transform);
MeshFilter filter = go.AddComponent<MeshFilter>();
Mesh mesh = filter.mesh;
MeshRenderer mr = go.AddComponent<MeshRenderer>();
// something
mesh.vertices = points.ToArray();
mesh.triangles = triangles.ToArray();
mesh.RecalculateNormals();
go.AddComponent<MeshCollider>();