Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - GorillaOne

Pages: [1]
1
Support / Re: Layout and SetBounds
« on: March 08, 2014, 06:07:41 pm »
For what it's worth, it would be a nice feature to be able to change the pivot of the layout.

2
Support / Re: Layout and SetBounds
« on: March 08, 2014, 06:07:10 pm »
Ok, so the pivot is always the top left. If the root GameObject is centered in the screen, that means I'll need to create a child GameObject to contain the layout which is positioned at the top-left of the screen in order to get stuff to work correctly. That sound about right?

3
Support / Layout and SetBounds
« on: March 08, 2014, 07:28:12 am »
I have a tk2dlayout script attached to a GameObject which gets centered in the screen. I want to have the layout bounds resize to fit the screen, whatever the resolution is (iPad vs iPhone). However, whenever I set bounds on the layout object it uses the GameObject as the fulcrum in the upper left corner.

How can I go about having the layout center on the GameObject?

Code:
Code: [Select]
       //Resize layout
        tk2dUILayout layout = GetComponent<tk2dUILayout>();

        //Assumes a parent in the screen center.
        Vector3 min = new Vector3(tk2dCamera.Instance.ScreenExtents.xMin, tk2dCamera.Instance.ScreenExtents.yMin, 0);
        Vector3 max = new Vector3(tk2dCamera.Instance.ScreenExtents.xMax, tk2dCamera.Instance.ScreenExtents.yMax, 0);
        layout.SetBounds(min, max);



Attached is a picture showing an outline of the camera, and the pink line being the layout bounds. You can see that the upper left corner of the layout bounds is in the center of the camera, where the GameObject is located.

4
Support / Re: Adding objects to a Scrollable Area through code
« on: February 11, 2014, 11:22:40 pm »
Thanks for the info.

5
Support / Adding objects to a Scrollable Area through code
« on: February 11, 2014, 06:28:39 am »
 I am currently using a ScrollableArea_Vertical prefab with an attached Scrollbar. My desired functionality is to start the program with no objects added to the ScrollableArea_Vertical content object, but to add them through script later. The challenge is that when Unity starts and the ScrollableArea_Vertical has no objects in it's content area, it disables the Scrollbar.

What is the best way to add objects to the ScrollableArea_Vertical in script during runtime and activate the Scrollbar for normal use? I have attempted to call

(pseudo code)
tk2dUIScrollableAreaObject.MeasureContentLenghth();
Scrollbar.SetActive(true);

No apparent results.

Pages: [1]