Wrong scale for prefab on mobile devices

I have a prefab that positions nicely in the editor and on my computer (regardless of aspect ratio), but whenever I run it on a mobile device the scale will be off. I guess it’s not scaling for DPI.
The prefab consists of an empty gameobject that contains a button and a checkbox.

I’m adding the prefab to a canvas via script, because I don’t know how many I’ll need until runtime. Everything in the menu that I didn’t add via script scales nicely, it’s just this prefab.

Any idea what to look for?

I’ve tried setting the overload for transform.setparent(transform, false), I’ve tried multiplying the scale with the scalefactor. So far, no luck. This thing is holding me back from finishing up, so I’d really appreciate some help! Thanks a lot :slight_smile:

OK I found out that setting the scale of the prefab via code doesn’t do anything. I can set the scale of the parent though, but then the scale factor is all wrong.

I’m very confused by this all. Any suggestions for what to do? I need to create a button with accompanied checkbox in the right size via code…