Author Topic: UIStretch, Prefabs and Root Problems.  (Read 2397 times)

MaskedPixel

  • Guest
UIStretch, Prefabs and Root Problems.
« on: August 27, 2012, 02:10:49 PM »
I have a prefab in which one of its children needs to have UIStretch on it.  When I NGUITools.AddChild it to the panel, the stretching doesn't work.  The reason is because mRoot in UIStretch is null.  It works fine after being disabled, and then enabled.  This is because mRoot is only assigned to in OnEnable.

Is there a more elegant solution than toggling enabled?

EDIT:  Other than changing NGUI code that is.
« Last Edit: August 27, 2012, 02:16:49 PM by MaskedPixel »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIStretch, Prefabs and Root Problems.
« Reply #1 on: August 27, 2012, 02:24:46 PM »
Change OnEnable to be Start instead.