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.

Topics - pretender

Pages: 1 2 [3] 4
NGUI 3 Support / Context sensitive menus in 3.5.7
« on: November 25, 2013, 09:23:09 AM »
I tried to bring up context sensitive menus like you described in the video. At first it did not work but than started to appear but everything is grayed out. I can't select anything. Is this due to using unity 3.5.7? Is it supposed to work or no?

Thanks! Btw great update!

NGUI 3 Support / TweenRotation question
« on: November 23, 2013, 12:42:42 PM »
Hi! This is slightly offtopic but I would like to know is it possible to use TweenRotation in such a manner to rotate object as using that object is rotated by an axis i specify. I want to take advantage of using tweening styles, control over animation and other stuff from ngui.

to get more specific, i want to rotate a cube around Vector3.up no matter what rotation of the cube is. Tween asks for Quarternion and i don't know how to convert.

Thank you!

NGUI 3 Support / 3D draggable panel
« on: August 05, 2013, 05:47:57 AM »
Hi! I am trying to make 3d ui draggable panel. It works good but when container (look at the hierarchy) is rotated, label with text which is draggable inside the panel sometimes disappears, mostly when i drag to the top and bottom when spring starts to return to item to top. I noticed when rotation angle is smaller then it seems that things are working better. thanks you!

it is simple setup, like this:

    drag panel

what to do, how to make it display correctly.

Hi! I am struggling with this problem for a while, although i searched forum and tried to forge the solution but did not succeed.
I am trying to get two panels side by side one on the right that will hold menu buttons and one on the left that will hold content. I am using fixedSize to get everything scale properly for both mobile and desktop devices for all resolutions.

there are no step by step instructions for this kind of thing and no clear explanation how to use all those anchors,pixeadjustments and scaling styles. there are many combinations and i get entangled any time i tried to do it. sorry about asking again and again the same things but i just cant figure it out!

Look at the picture

NGUI 3 Support / two draggable panels side by side?
« on: June 26, 2013, 12:05:10 PM »

I want to make two draggable panels side by side where left one would take 1/3 of the screen and right one would
take 2/3 of the screen. I am using fixed size.

I decided to make both panels anchor to left. and to position them side by side, but i don't know how to make right one to strech to the end of the screen. I know i cant use width and i tried with scale but no luck. I want to avoid using UIStrech if possible because it will distort the elements.

Is this possible with NGUI (i need it to work on mobiles and desktops). I am using NGUI for a year now but i come across some things that i dont know how to do once in a while, so i need help!

Thanks! great package!

NGUI 3 Support / trying to make a grid of widgets
« on: June 14, 2013, 07:54:47 AM »

i made a prefab with one sliced sprite and few labels. position and rotation is at zero while scale is at 1,1,1
i instantiate prefab and made it child of a panel but scale goes to 360,360,360 and position goes to some weird number like 100800,56000,0

scales leading to widgets are all 1,1,1 except the root.


when i place the widget in the editor i get correct position and scale, doing it from the code it messes everything up.
here is the code i am using:

  1. e = GameObject.Instantiate(element,new Vector3(0f + 40 * x_index,0f + 40 * y_index, 0f),Quaternion.identity) as GameObject;
  2.                                                 e.transform.parent = Panel.transform;

any help appreciated!

NGUI 3 Support / UIDragObject
« on: May 10, 2013, 09:07:11 AM »
I was searching through the forums how to use UIDragObject on 3d objects but no luck. I managed to use UIDragObject
on widgets just by placing script on the widget with collider and setting its target. It does not want to play like that when dropping on simple cube. what i need to check? layers,event receiver mask,clip raycasts? i tried all combination that i could think of and what made the most sense but i can get it to work. I put collider on the object, UIDragObject and set its target.

i made a simple script with only function like this
  1. void OnDrag()
  2. {
  3.     Debug.Log("Dragging");
  4. }

so to let me know when it detected the dragging, but nothing happens

what i am doing wrong? thanks!

NGUI 3 Support / how to make hierarchy tree?
« on: April 29, 2013, 12:09:00 PM »
Hi! Great package!

I want to make scrollable/expandable hierarchy tree. I am aware of composite design pattern that i will use but
what is the best practice to do this with NGUI?

i did this before by simply adding prefabs to UIGrid and it worked but it did not have expand feature but the hierarchy was rebuilt
every time for different selection. now what is the best approach to have expanding? how to achieve to have new elements added to the grid or table at the proper place with all other elements moving to make room for new elements?

Any thoughts are very well welcome :D

Hi!  Great package, i am using it for a while.
I have a problem and i am not sure how to resolve it.

I have draggable panel with grid inside that holds gui elements dynamically added.
i need to draw 2d line (with another package) and i need to get viewport coords of
elements inside the draggable panel (under grid).

i am not sure what i need to be using (position,localPosition, WorldToViewport or WorldToScreen and what camera for converting coords)

here is what i have tried:

  2.                 GameObject s = NGUITools.AddChild(grid,microlabel2DPrefab);
  4.                 s.GetComponentInChildren<UILabel>().text = ml.GetName();
  5.                 grid.GetComponent<UIGrid>().Reposition();
  7.                 Vector3 mPos = GameCam.WorldToViewportPoint(ml.GetStartPos());
  8.                 Vector3 gPos = GameCam.WorldToViewportPoint(s.transform.position);
  9.                 VectorLine l = VectorLine.SetLine(lineColor,gPos,ml.GetStartPos());

ml is just GameObject with Transform
and s i prefab that is put in grid inside draggable label

i want to draw 2d line from element in the grid to projected 2d position of gameobject.

any help appreciated!

[EDIT]: just to add that gui element is visible only by Ngui cam and object in the scene with gamecam. the usual setup.

TNet 3 Support / Failed to read past end of stream error
« on: March 12, 2013, 08:31:37 AM »
i am trying to update camera distance with this code but i get Failed to read past end of stream error what i am doing wrong?:
  1.  void Apply()
  2.     {
  3.         if( smoothMotion )
  4.         {
  5.             distance = Mathf.Lerp( distance, IdealDistance, Time.deltaTime * smoothZoomSpeed );
  6.             yaw = Mathf.Lerp( yaw, IdealYaw, Time.deltaTime * smoothOrbitSpeed );
  7.             pitch = Mathf.Lerp( pitch, IdealPitch, Time.deltaTime * smoothOrbitSpeed );
  8.         }
  9.         else
  10.         {
  11.             distance = IdealDistance;
  12.             yaw = IdealYaw;
  13.             pitch = IdealPitch;
  14.         }
  16.         if( smoothPanning )
  17.             panOffset = Vector3.Lerp( panOffset, idealPanOffset, Time.deltaTime * smoothPanningSpeed );
  18.         else
  19.             panOffset = idealPanOffset;
  21.         transform.rotation = Quaternion.Euler( pitch, yaw, 0 );
  22.         transform.position = ( target.position + panOffset ) - distance * transform.forward;
  25.                 tno.Send(2, Target.OthersSaved, distance);
  26.         }
  28.         [RFC(2)] void UpdateDistance(float d)
  29.         {
  30.                 distance = d;
  31.         }

TNet 3 Support / connection over 3g
« on: March 11, 2013, 07:40:27 PM »
Is it possible to host a server and to connect to it through 3g network? (android - android device)

NGUI 3 Support / Scaling instantiated gui prefabs
« on: March 11, 2013, 06:37:37 AM »

I am trying to setup scaling of instantiated NGUI prefabs. The things is that i want elements to scale based of cameras z position
and it works well for one resolution but when resolution is changed then NGUI elements are resized (as expected!). so how to take ratio,or root into account and make scaling same in all resolutions? I have pixel perfect setup in the UIRoot

Thank you!

TNet 3 Support / Beginner with networks needs some help!
« on: March 07, 2013, 01:49:21 PM »
Hi! TNet is something i think it will be very useful as NGUI was to me! But being a beginner in networking i am struggling like i once was with NGUI. But i think when i get a handle of it will be easy to get things done.

I was going through examples and i played with them a bit, the most useful situation for me is the fact that it is possible to create a server on mobile device and let others connect. I doubt that i will use standalone server for now, its good to know that is possible too.

So i have a few questions
1.) in the example menu you used Update() to get the list of available servers. Is there and event that fires when servers are available? I would avoid using Update (i could use coroutines to periodically check for servers though, but event would be great), how to broadcast to everybody on lan that there is new server started
2.) i do not understand how to distinguish between the client and host. if one player starts the server, is his device a host? and is there a difference how host connects to server from client? is that the reason why there are few types of TNManager.Connect methods?
3.) when we should be using udp and when tcp? do we need to start to StartUDP at the beginning?

these are my questions for now! i am sorry that most of them are beginner questions, but a lot of new info is there that i have to process :D

Thank you!

Hi! Excellent package!

I am having a problem though. I am trying to instantiate ngui element prefab and set the position of the element so it is directly above the object i clicked on. So i figured that i have to transform position from world to screen

i am using this code:

  1.                 _go = NGUITools.AddChild(staticLabelROOT,staticLabelPrefab);
  2.                 _go.transform.localPosition = NGUICamera.WorldToScreenPoint(t.position + direction * 0.2f);

NGUICamera is refernce to NGUI camera, and position that is passed is just vector that is slighly offset to the target object.

Labels appear but there is an offset, what i did wrong and what i need to take care in order labels are where they should be?



I have a draggable panel that goes from top to bottom of the screen. I have a script that adjusts clipping properly based on Screen.height. Here is the code:

  1. int maxHeight = GameObject.Find("UI Root (2D)").GetComponent<UIRoot>().maximumHeight;
  3.                 Vector4 tmp = this.GetComponent<UIPanel>().clipRange;
  5.                 if(Screen.height > maxHeight)
  6.                         tmp = new Vector4(0,0,0,maxHeight);
  7.                 else
  8.                         tmp = new Vector4(0,0,0,Screen.height);
  10.                 this.GetComponent<UIPanel>().clipRange = tmp;
  11.                 this.GetComponent<UIDraggablePanel>().ResetPosition(); 

I attach this to any draggablepanel object that i want clipping to be from top to bottom and it works.
The problem is that when going fullscreen, this code will not work any more! I tried everything i could think of, but basically
calling this code after app is in fullscreen does not again correctly position clipping.

Is there any ideas that i can try, i waited few frames until app goes into fullscreen and then tried to position again. I really can't figure this out, any help appreciated!

Pages: 1 2 [3] 4