Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: PabloAM on December 06, 2016, 07:50:26 AM

Title: LocalScale doesn´t work inside UIGrid or UITable
Post by: PabloAM on December 06, 2016, 07:50:26 AM
Hello, I can´t rescale a gameobject when I add to a UIGrid or UITable.

I tried with those ways:

  1.  ItemSurpriseBox item2 = PoolManager.Pools[Globals.poolGameManager].Spawn("ItemWon").GetComponent<ItemSurpriseBox>() as ItemSurpriseBox;
  2.         item2.transform.localScale = new Vector3(0.3f, 0.3f);
  3.         item2.SetInfo(Globals.TypeItem.propMax, "2", false);
  4.         Vector3 tmp = item2.gameObject.transform.localScale;
  5.         tmp.Set(0.6f, 0.6f,1f);
  6.         item2.gameObject.transform.localScale = tmp;
  7.  
  8.         NGUITools.AddChild(itemsWonWid.table.gameObject, item2.gameObject);
  9.         ////itemsWonWid.table.Reposition();
  10.         PoolManager.Pools[Globals.poolGameManager].Despawn(item2.transform);
  11.  

Second attempt:
  1.   ItemSurpriseBox item1 = PoolManager.Pools[Globals.poolGameManager].Spawn("ItemWon").GetComponent<ItemSurpriseBox>() as ItemSurpriseBox;
  2.         item1.SetInfo(Globals.TypeItem.comboKm, "1", false);
  3.         NGUITools.AddChild(itemsWonWid.table.gameObject, item1.gameObject);
  4.         //itemsWonWid.table.Reposition();
  5.         PoolManager.Pools[Globals.poolGameManager].Despawn(item1.transform);

Any of them works.

Any suggestion?


Thanks!
Title: Re: LocalScale doesn´t work inside UIGrid or UITable
Post by: ArenMook on December 06, 2016, 08:02:01 AM
NGUI works best when you don't scale objects. Still, if you want, you can always parent it to another game object and scale that other game object instead. Note that anchoring was designed to work with scales remaining (1, 1, 1).
Title: Re: LocalScale doesn´t work inside UIGrid or UITable
Post by: PabloAM on December 06, 2016, 08:16:01 AM

So I should parent to an empty gameobject and create a script to set the information to the child object that is my "ItemWon", I shoudn´t?

Thanks ArenMook!