How to set up collision for a static mesh assigned at runtime?

Found the problem. I had to give the class a default static mesh in the constructor. I found updating the collision after changing the mesh is also necessary.