Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

constant physical size + layout group = scaling bug?

Discussion in 'UGUI & TextMesh Pro' started by Febtober, Jun 12, 2015.

  1. Febtober

    Febtober

    Joined:
    Mar 19, 2015
    Posts:
    3
    I changed my canvas scaler to "Constant Physical Size" and then my layout group component prefabs got scaled to 0.26...something. As soon as I return back to "Constant Pixel Size" then everything is back to normal. I have created a layout group element identical to my prefabs and it doesn't suffer from the scaling problem. It seems only runtime prefabs are affected.

    Is there something I am missing here or is this a bug? Check out the screenshot and I also attached a minimal project to demonstrate.
     

    Attached Files:

    AbleArcher likes this.
  2. Febtober

    Febtober

    Joined:
    Mar 19, 2015
    Posts:
    3
    I'm going to answer my own question here, but I am not happy with this solution. Basically I added a script that resets the scale back to 1, in Start. I feel that I am missing something here, or this is definitely a bug.

    The wrong scale changes with the units that I pick (millimeters, inches, etc...), though I still don't understand why.
     
  3. AbleArcher

    AbleArcher

    Joined:
    Feb 27, 2017
    Posts:
    9
    I ran into into the same issue. Eventually I noticed some warnings that said:

    "Parent of RectTransform is being set with parent property. Consider using the SetParent method instead, with the worldPositionStays argument set to false. This will retain local orientation and scale rather than world orientation and scale, which can prevent common UI scaling issues."

    Indeed, I switched from the property to `SetParent` and it resolved the issue for me.
     
    Last edited: Oct 13, 2017
    jesusmgg likes this.