Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: saarix on August 25, 2014, 09:30:48 AM

Title: Dynamic Scroll View
Post by: saarix on August 25, 2014, 09:30:48 AM
Hi everyone,

i'm having trouble with creating dynamic scroll view. In script I have a list of servers and for each server I creating a new object (Sprite) as a child of scroll view. But positions of sprites and scroll view itself are crazy after script completes generating process.

Here's screen of  the result and also script i'm using below
(http://imagizer.imageshack.us/v2/150x100q90/674/sZn40l.png) (http://imageshack.com/f/iqsZn40lp)
(http://imagizer.imageshack.us/v2/150x100q90/539/vOOwCN.jpg) (http://imageshack.com/f/ezvOOwCNj)

In servers collection is 5 records
  1. for (int i = 0; i < servers.Count; i++)
  2.         {
  3.             Debug.Log("Creating " + i + " object.");
  4.             newItem = (GameObject)Instantiate(ServerItem,
  5.                 new Vector3(124, 54 - (60 * i), 0), Quaternion.identity);
  6.             newItem.transform.parent = scrollView.transform;
  7.         }
  8.  

But calculated position is right... mistake must be somewhere else but I can't see it :( Thanks for any help.
Title: Re: Dynamic Scroll View
Post by: saarix on August 25, 2014, 12:44:29 PM
Problem solved. I just had to use localposition and localscale :-) totally forgot it.