Author Topic: UISprite drawing issue  (Read 2969 times)

Pikol

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
UISprite drawing issue
« on: October 22, 2014, 02:44:12 AM »
Hi all.
I've been running into an issue with UISprite.
I have prefab for simple chat message, it have special script - anchor binding that set anchors by some conditions (text size, like phone messages).
Sometimes, when script set anchors, it look like that:

As you can see - physically sprite placed normally (on right side), but it was drew outside them rect. And what the worst - i have no idea what is going wrong.
« Last Edit: October 22, 2014, 03:22:03 AM by Pikol »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISprite drawing issue
« Reply #1 on: October 22, 2014, 05:44:49 AM »
Do you call UpdateAndResetAnchors after changing them?

Also have a look at EnvelopContent script. It does what its name suggests.

Pikol

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: UISprite drawing issue
« Reply #2 on: October 22, 2014, 06:24:36 AM »
Thanks for answer, but i use script almost same with EnvelopContent - this script repositions his children inside relative to pivot and fits to total size of all childs.