I use raycasting to place some objects on the 3d map with a correct height. But atm there is no MeshCollider component on the map tiles. That's why raycasting does not work.

If I add MeshCollider in Unity editor when project is playing - everything works. Unity assign the correct mesh in runtime from editor.

But when I try to add MeshCollider from code, MeshCollider component misses the mesh reference.

This code doesn't help.
[RequireComponent(typeof(MeshRenderer), typeof(MeshFilter), typeof(MeshCollider))]
public class UnityTile : MonoBehaviour, INotifyPropertyChanged
{
<...>
void Start()
{
GetComponent<MeshCollider>().sharedMesh = MeshFilter.mesh;
}
}
In earlier SDK versions raycasting worked out of the box. Now I'm using v0.5.1-beta. How can I do it now?
Thanks.
Cheers.
I use raycasting to place some objects on the 3d map with a correct height. But atm there is no MeshCollider component on the map tiles. That's why raycasting does not work.
If I add MeshCollider in Unity editor when project is playing - everything works. Unity assign the correct mesh in runtime from editor.
But when I try to add MeshCollider from code, MeshCollider component misses the mesh reference.
This code doesn't help.
In earlier SDK versions raycasting worked out of the box. Now I'm using v0.5.1-beta. How can I do it now?
Thanks.
Cheers.