Welcome,
Guest
. Please
login
or
register
.
April 27, 2026, 12:29:43 AM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
LocalScale doesn´t work inside UIGrid or UITable
« previous
next »
Print
Pages: [
1
]
Author
Topic: LocalScale doesn´t work inside UIGrid or UITable (Read 6542 times)
PabloAM
Jr. Member
Thank You
-Given: 1
-Receive: 0
Posts: 58
LocalScale doesn´t work inside UIGrid or UITable
«
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:
ItemSurpriseBox item2
=
PoolManager
.
Pools
[
Globals
.
poolGameManager
]
.
Spawn
(
"ItemWon"
)
.
GetComponent
<
ItemSurpriseBox
>
(
)
as
ItemSurpriseBox
;
item2
.
transform
.
localScale
=
new
Vector3
(
0
.
3f, 0
.
3f
)
;
item2
.
SetInfo
(
Globals
.
TypeItem
.
propMax
,
"2"
,
false
)
;
Vector3 tmp
=
item2
.
gameObject
.
transform
.
localScale
;
tmp
.
Set
(
0
.
6f, 0
.
6f,1f
)
;
item2
.
gameObject
.
transform
.
localScale
=
tmp
;
NGUITools
.
AddChild
(
itemsWonWid
.
table
.
gameObject
, item2
.
gameObject
)
;
////itemsWonWid.table.Reposition();
PoolManager
.
Pools
[
Globals
.
poolGameManager
]
.
Despawn
(
item2
.
transform
)
;
Second attempt:
ItemSurpriseBox item1
=
PoolManager
.
Pools
[
Globals
.
poolGameManager
]
.
Spawn
(
"ItemWon"
)
.
GetComponent
<
ItemSurpriseBox
>
(
)
as
ItemSurpriseBox
;
item1
.
SetInfo
(
Globals
.
TypeItem
.
comboKm
,
"1"
,
false
)
;
NGUITools
.
AddChild
(
itemsWonWid
.
table
.
gameObject
, item1
.
gameObject
)
;
//itemsWonWid.table.Reposition();
PoolManager
.
Pools
[
Globals
.
poolGameManager
]
.
Despawn
(
item1
.
transform
)
;
Any of them works.
Any suggestion?
Thanks!
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: LocalScale doesn´t work inside UIGrid or UITable
«
Reply #1 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).
Logged
PabloAM
Jr. Member
Thank You
-Given: 1
-Receive: 0
Posts: 58
Re: LocalScale doesn´t work inside UIGrid or UITable
«
Reply #2 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!
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
LocalScale doesn´t work inside UIGrid or UITable