Welcome,
Guest
. Please
login
or
register
.
April 27, 2026, 08:57:48 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
wrapping UIGrid contents
« previous
next »
Print
Pages: [
1
]
Author
Topic: wrapping UIGrid contents (Read 4608 times)
jrhee
Newbie
Thank You
-Given: 0
-Receive: 2
Posts: 13
wrapping UIGrid contents
«
on:
July 27, 2014, 10:33:41 PM »
Hi Aren,
I have a horizontal UIGrid with a column limit of 3. I'd like to have the grid contents wrap onto additional rows if the combined cell width exceeds the grid widget dimensions (example attached). Is this possible currently out of the box? Would like to check before scripting something.
Thanks!
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: wrapping UIGrid contents
«
Reply #1 on:
July 27, 2014, 11:25:31 PM »
There is nothing in NGUI that would facilitate this kind of functionality -- you would need to code it yourself.
Logged
jrhee
Newbie
Thank You
-Given: 0
-Receive: 2
Posts: 13
Re: wrapping UIGrid contents
«
Reply #2 on:
July 28, 2014, 02:58:13 AM »
Ok thanks- here's the script I came up with in case anyone's interested.
using
UnityEngine
;
using
System.Collections
;
public
class
UIGridWrapping
:
UIGrid
{
void
Start
(
)
{
UpdateMaxPerLine
(
)
;
base
.
Start
(
)
;
}
[
ContextMenu
(
"Execute"
)
]
public
override
void
Reposition
(
)
{
UpdateMaxPerLine
(
)
;
base
.
Reposition
(
)
;
}
void
UpdateMaxPerLine
(
)
{
maxPerLine
=
(
int
)
(
GetComponent
<
UIWidget
>
(
)
.
width
/
cellWidth
)
;
}
}
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
wrapping UIGrid contents