Search Unity

  1. Unity 2018.3 is now released.
    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. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Nominations have been announced for this years Unity Awards. Celebrate the wonderful projects made by your peers this year and get voting! Vote here!
    Dismiss Notice
  6. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Canvas/UI Repositioning on Initialisation

Discussion in 'Unity UI & TextMesh Pro' started by ajmc123, Dec 4, 2018.

  1. ajmc123

    ajmc123

    Joined:
    Dec 4, 2018
    Posts:
    25
    Hey Everyone,
    Bit of a programming dummy here, so please be gentle lol. I am attempting to make a 2d rpg in Unity, and I had a health bar and Level/Exp bar set up using sliders that used to work perfectly. Now, whenever I start up my game they work fine, it's just they are out of frame. They are perfectly in frame in the scene view in the canvas, and I am just at a loss. I was recently messing around with some audio related stuff, but not too much UI, but maybe I affected something there. Any help is appreciated because I kinda wanna die rn. Thanks so much!
     
  2. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    531
    what do you mean? are they outside of the visible area? If yes: make sure you anchored them correctly:
     
  3. ajmc123

    ajmc123

    Joined:
    Dec 4, 2018
    Posts:
    25
    I don't think that's the issue, it is anchored in the scene view just fine, but for some reason whenever I start the game, the health bar and everything get's shifted to the left outside of the canvas.
     
  4. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    531
    that sounds very much like an anchoring problem. can you post a screenshot of the rect transform of one of your bars as well as the hierarchy?
     
  5. ajmc123

    ajmc123

    Joined:
    Dec 4, 2018
    Posts:
    25
    Screen Shot 2018-12-05 at 5.53.34 PM.png Screen Shot 2018-12-05 at 5.54.34 PM.png here they are.
     
  6. ajmc123

    ajmc123

    Joined:
    Dec 4, 2018
    Posts:
    25
  7. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    531
    I see there pixel positions and pixel width and heights... so, the anchors are not set correctly. Please watch the video I posted.
     
  8. ajmc123

    ajmc123

    Joined:
    Dec 4, 2018
    Posts:
    25
    I tried anchoring it, yet I am still seeing the width and height. Is it a bug? Or is it something else? I am so lost, and quite honestly pretty mad lol.
     
  9. ajmc123

    ajmc123

    Joined:
    Dec 4, 2018
    Posts:
    25
    I feel like it's a problem with my Camera because it doesn't quite reach the edge of my bounds as well.