Search Unity

  1. Unity 2019.1 beta is now available.
    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. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Unity 2018.3 is now released.
    Dismiss Notice
  6. 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:
    28
    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:
    633
    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:
    28
    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:
    633
    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:
    28
    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:
    28
  7. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    633
    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:
    28
    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:
    28
    I feel like it's a problem with my Camera because it doesn't quite reach the edge of my bounds as well.