Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

UI Scaling bug or am i missing something?

Discussion in 'Unity UI & TextMesh Pro' started by fede998, Nov 10, 2018 at 6:08 PM.

  1. fede998


    Oct 15, 2018
    I'm kinda new to Unity and im following a series of video about creating a rpg battle system but i ran into a problem with the GUI.
    Here's the problem: I have to fill a panel with buttons automatically using scripts and buttons' prefabs but, as long as i put buttons' prefabs in the gameobject(which resize them for the panel) by dragging the prefab into the gameobject in the hierachy everything works fine.
    Here's the photo:
    The problem begins when unity has to do it automatically.
    I followed the video and im using the same script but when the buttons are automatically created in the gameobject they are not sized correctly.
    Here are the photos which show the difference:
    Well, i have to say it worked fine since in another video i had to change the Canvas scaler from "constant pixel size" to "scale with sceen size" to fit the heroes information.
    Now i'm in a kind of limbo where if i keep "scale with sceen size" the enemy panel works bad and if i use "constant pixel size" the hero panel has troubles.
    Hope u have some good tips and im sorry if it's not a perfect English, for any informations you are free to ask.
    Last edited: Nov 10, 2018 at 6:15 PM
  2. Hosnkobf


    Aug 23, 2016
    I also had a lot of problems with the canvas scaler options. It never worked the way I wanted...
    That's why I created Better UI. Sorry that I cannot give you advise how to solve it with UGUI alone.