Hello everyone! I am new to Unity, so I hope my question won’t be out of place here. I have been searching for a solution to my problem, but haven’t found anything that would solve it. Decided to give it a shot and ask.
So, what I am aiming for (in 2D) is to make different color squares fall down and stack one on top of another. I am using Meshes
to programmatically create squares. I create them in the Start()
method of a GameObject
I place in a scene. Since this object has a Rigidbody2D
, Unity does not allow me to attach a Mesh Collider
directly to it. Hence, I have added another GameObject
that sits within the first one and has a Mesh Collider
attached to it. In the code, where I create a Mesh
, I also assign it to the Mesh Collider
from the second GameObject
.
The collider is being created and I can see it (the green lines) when I run the project. However, it does not collide with any other colliders. For example, I have a bottom surface as a simple wide Box Collider, but my square just falls through it.
I assume, I am missing some Unity knowledge, but I am not sure where to look for answers any more. It would be great if someone could suggest a solution or point me where I could find an answer. Thanks!