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 - dipu5683

Pages: 1 [2]
16
Hi

My prefab architecture is like below.
MainMenu (Empty Gameobject) having page script(CMainMenu.cs) which will execute when this prefab comes in memory.
  Child Container (empty gameobject)
        Sprite (background image) attached a custom unifiied anchor scrip to stretch & anchor using UIRoot.
        UIButton 1 - anchored (left top) using custom script using UIRoot. 
        UIButton 2 - anchored (center)using custom script using UIRoot.
        UIButton 3 - anchored (right bottom)using custom script using UIRoot.
Now my page is done.
Now i want from this page to come on screen with tween animation say left to right etc. For that what i did ,when MainMenu prefab instantiated CMainMenu.cs executed . its Start() i added a this.gameObject.AddComponent<TweenPosition>(); on runtime.
provided some tween from to "to" position and added some onFinished event , but before that i just disable my anchor script from Sprite (background image) similarly from button also and after the animation i just enabled it. Other wise tween animation wont happen.
Now page animation is done but with some dirty jerk. moment i remove my unified anchor script it resized , got animation because of tween and at the end again comes to original size because i enabled the anchor script. Which is not looking very smooth.
Can't we tween the base container MainMenu without affecting any of the child element having unified anchor or custom anchor?
i am creating a generic tool where we specify the page transition with animation type , it will take care of every thing else.
I have created to custom script for Unified Anchoring & Custom Anchor , which uses the UiRoot (Fixed to 720) reference at runtime , according to that my background got stretched , button got anchored etc.














         

17
Hi

I am creating the interface. On click of some button next page intantiated & came on the screen with some tween position animation from right to left of the device screen.

My page prefab architecture is like below.

mainmenu (empty gameobject) - contains page script attached.
   childcontainer (empty gameobject)
      UIButton  (Right aligned using anchor)
      BG Sprite ( having Unified anchor script to stretch and anchor to device resolution)

When the mainmenu prefab loaded attached page script executed. In its initialise function() i wrote code for to add tween animation.
i have enable or disable the unified anchor script in order to tween position. But the moment i remove my Unified anchor script  my bg sprite got resized .
Means at the start of tween i disabled the unified anchor , and on end again enabled.

Simply i want my prefab (page) should came from left to right or with any tween animation on the screen without affecting the anchors.

Thanks


18
NGUI 3 Support / Re: Joystics dragging issue.
« on: April 21, 2014, 01:49:30 AM »
Thanks Aron

means i have to multiply my radius (150 px ) * UIRoot.pixelSizeAdjustment in order to get approximate value of 150px radius as per device resolution.


19
NGUI 3 Support / Joystics dragging issue.
« on: April 14, 2014, 01:41:41 AM »
Hi

I am trying to create a joysticks. I used the code from below link

https://gist.github.com/anonymous/6839160

Here I am using joystick bg image width is 302*300 pixel. So my ClampRadius is 151 unit.  On pc  its working fine but when i tested it on different screen resolution on device (android) it's dragging very little on Highresolution(1280*800).

target.transform.localPosition = new Vector3(Vector3.ClampMagnitude(target.transform.localPosition, ClampRadius).x, Vector3.ClampMagnitude(target.transform.localPosition, ClampRadius).y, 0);

I seems that ClampRadius of 151 pix is very small for high resolution device. But my bg sprite is rendering fine 302*300 pixel.

So how can we solve this issue?


20
NGUI 3 Support / Re: NGUI page scaling
« on: April 05, 2014, 02:12:00 AM »
Thanks Aren , code is working fine.
I have created a generic script .

sprite.SetAnchor(uiRoot.transform);
sprite.leftAnchor.Set(relativeLeftAnchor , leftAnchorAbsVal);
sprite.rightAnchor.Set(relativeRightAnchor , rightAnchorAbsVal);
sprite.bottomAnchor.Set(relativeBottomAnchor , bottomAnchorAbsVal);
sprite.topAnchor.Set(relativeTopAnchor , topAnchorAbsVal);
sprite.ResetAnchors();
sprite.UpdateAnchors();

Which is exactly correct at the run time. But at the design time of prefab how can i achieve this?
Each time i have to run the prefab and check at run time alinement and stretching at different resolution.


21
NGUI 3 Support / Re: NGUI page scaling
« on: April 02, 2014, 01:15:09 PM »
Hi

I have created a custom anchor stretch script to anchor & stretch the bg.

UIRoot uiRoot = NGUITools.FindInParents<UIRoot> (this.gameObject);

sprite.SetAnchor(uiRoot.transform);
sprite.leftAnchor.absolute = 0;
sprite.rightAnchor.absolute = 0;
sprite.topAnchor.absolute = 0;
sprite.bottomAnchor.absolute = 0;
         
This is working absolutely correct in case of background image.Its streching as per device resoulution.

But When i am trying to anchor and stretch the topbar sprite (628*50) to align top (with full width of device & 50 in height) then it's not working correctly. The same thing is also happening with UIButton when tried to anchor bottom left with some offset.
How can i anchor a sprite of say 302*300 to the bottom right?




22
NGUI 3 Support / Re: NGUI page scaling
« on: April 01, 2014, 02:27:56 AM »
Aren now i understand that in prefab, we cant make any references of the GameObject from the scene.

But i am making a build for iOS and Android. And as per my understanding i create seperate builds for iPad and iPhone with UIRoot's manual height (fixedsize) to 768 and 640 respectively.

Due to this, i am keeping the UIRoot prefab in Project and directly sets the anchor references in the page prefab. (please refer the attached image).

is it a correct way? or is there any better way to handle this kind of situation?



23
NGUI 3 Support / Re: NGUI page scaling
« on: March 28, 2014, 05:27:47 AM »
Thanks for the replay Aren.

this is working fine in a scene.

But now i am instantiating prefbs dynamically.
In that case, the sprite on which i set unified UIAnchor, got reset to none.

What is wrong i am doing?

24
NGUI 3 Support / NGUI page scaling
« on: March 28, 2014, 12:58:22 AM »
hi

I am newer to ngui. I am creating a interface using ngui for Mobiles . My app have a UIRoot . I am creating a prefab for any page say main menu  it consists of sprite as BG , UIbutton for back and forward movement , some title sprite etc. I am using the latest version of ngui. When i transferred the app on device ( 1280*800 ) or (960*640) ,i am facing the streching issue. BG is not stretched according to device resolution , button anchor got changed etc....
I tried UIStrech  with Both params set to stretch the BG & UIAnchor to anchor the buttons, title etc.
But there is still some borders left at left and right and also buttons are not positioned as per anchor.
(My UIRoot settings are FixedSize and height is 640)

Can some one help me ? How can we design our ngui(interface) pages which got scaled (bg) automatically according to device resolution and button according to anchor?



thanks




25
NGUI 3 Support / NGUI Page Management
« on: March 10, 2014, 01:06:20 AM »
HI

I am newer to Unity. I an developing interface using NGUI. It consists of both Normal pages & Additive Pages. I want to know what is the best approach of doing this ?

Thanks

26
NGUI 3 Support / NGUI Page management
« on: March 07, 2014, 06:41:07 AM »
Hi

I am newer to unity. I am creating interface for my app using ngui. My interface consists of normal ngui pages and additive both.
Can any one suggest me what should be the best approach of doing this?

Thanks in advance

27
NGUI 3 Support / Detection of NGUI Page memory
« on: February 23, 2014, 11:58:58 PM »
Hi

I am newer to unity. I have created the pages using ngui. I want to display the runtime memory allocation after instantiating the prefab of the page.Is there is any way to do so?

Pages: 1 [2]