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

Pages: [1]
1
NGUI 3 Support / Re: Widget is always in front
« on: July 22, 2014, 03:03:10 AM »
@ Nicki: I also have tried what you suggest but that did not work out either.

But its really weird: yesterday without me doing or changing anything it suddenly started to work again.
I dont know why... that is not really convenient since i could unknowingly make the same mistake again. whatever it might have been. maybe the metafile was corrrupted or some other Unity hiccup.
 

2
NGUI 3 Support / Re: Widget is always in front
« on: July 18, 2014, 09:57:50 AM »
The setup is currently exactly the one that you suggest. (And was it before)

Thing is that the very same setup does work in one scene but not in another...
The GUI is a prefab i use in every scene. 

3
NGUI 3 Support / Widget is always in front
« on: July 17, 2014, 06:03:43 AM »
The problem i have is surely easy to solve nevertheless i do not know how. :(

To block the input to my gameworld while the menu or an dialogue is open i have created a huge collider that should lie behind all other widgets.
In fact no matter what i try -setting the depth of the panel and/or the widget to -200 or whatever-   the collider stays in front of everything. But that was not always the case. 
It could be that the way i structure my gui is a cause for this to happen:
For every part of the GUI - Menu, Dialogues, Cursor - i create a new camera and in the hierarchy of it all widgets that belong to this particular GUI are placed.
Sometimes the panels are above the camera in the hierarchy but i changed that already with no effect.
The camera´s configuration is always the same. Which also means that the depths are equal. I have played around with the depth at runtime but this had no effect either.
I also used the NGUI way and told the panel and the widget of the huge collider to be "pushed back" but as you may guess: no effect.
When i deactivate the gameobject everything is fine. Only that i cannot simply deactivate it cause it serves a function.

My question is now: What can i do to put it behind everything no matter what?
Btw: i am currently using version 3.5.6. I dont want to update but will do so, if it is a problem fixed in a later version

4
NGUI 3 Support / Re: Placing GUI elements based on object in scene
« on: July 09, 2014, 03:29:21 AM »
Thank you very much. that works well. I had to set the z value to some lower value so the uicamera shows it, though.
I would have needed ages to come to this solution. You saved me hours of work (or ages).

Is there some indepth tutorial about this topic somewhere? I searched the internet but found aside from unity documentation (which is anything but indepth) none.

5
NGUI 3 Support / Placing GUI elements based on object in scene
« on: July 08, 2014, 10:01:52 AM »
I don´t know if this was asked before but i could not find a thread for this one.

So here is my problem:
I have 2 cameras. One displays the scene and all objects the other one the gui.
I want to place a Sprite at the position of one of the objects.
I tried using
        uiCamera.WorldToScreenPoint(theObj.transform.position);
and
        uiCamera.WorldToViewportPoint(theObj.transform.position);

and aplying the resuling vector to the sprites transform.localPosition. (since it is a child of the camera displaying it)
But i always get results far beyond the view of my uiCamera.
I dont think this is a problem but i will tell you nevertheless: both cameras are at distinct positions not overlapping each other. SO the uiCamera sees nothing of the scene whereas the sceneCamera sees nothing of the ui.

My question would be: how does i properly place my sprite? Is there a completely other way i must go?

EDIT:
I might add that the gui camera is orthographic and the scene camera is set to be perspective

6
Before i come to the actual problem i have i want to explain in which environment it occurs.
When I check a checkBox i want to trigger multiple tweening operations on multiple objects with just this action. This is no problem.
For example: I want the window in which the checkbox is located to expand when it is checked and to shrink to its original size when it gets unchecked.
There is no problem in this because i can toggle the tweening operation.
But i also want that multiple elements appear on the additional space of the window while it expands. These elements should not appear simultaneously but after another (for example the top element first then the others and the element at the bottom is the last). In the same manner they should disappear when the window shrinks again. But now the bottom element has to disappear first and afterwards all the others. Obviously i cannot use toggle here.

Is there a possibility to somehow trigger tweening operations based on conditions without coding?
When coding is needed where should the scripts be placed? How should it be done?

7
Thank you that helped :)



8
I say "possible" because i am new to NGUI and the way I approach my problem could simply be the wrong one.

Imagine 2 buttons button A and Button B. Both Buttons have a UIButtonComponent and a TweenAlpha Component as well.
On program start button A is visible and Button B is invisible because its alpha is set to zero (Set in the UISprite Component).
When I click button A it disappears and button B appears. When I click Button B the same stuff happens only the other way around.

Here is the problem:After clicking button A and button B became visible. When I hover over button b and then unhover it again it simply fades away.
I am using the current version of NGUI 3.5.5.
I have localized a possible cause for this to happen.

The UIButtonColor Component uses the initial color of the widget to return to when no other state like hover or isPressed is true. But because the initial colorValue of the buttonWidget has an alpha of zero the button simply fades away.

Here are the parts of code in UIButtonColor I am talking about:

    protected virtual void OnInit ()
   {
      mInitDone = true;
      if (tweenTarget == null) tweenTarget = gameObject;
      mWidget = tweenTarget.GetComponent<UIWidget>();

      if (mWidget != null)
      {
         mColor = mWidget.color;
      }
      else

               // other stuff
____________________________________________________________________________

            // this is in the SetState method
             switch (mState)
         {
            case State.Hover: tc = TweenColor.Begin(tweenTarget, duration, hover); break;
            case State.Pressed: tc = TweenColor.Begin(tweenTarget, duration, pressed); break;
            case State.Disabled: tc = TweenColor.Begin(tweenTarget, duration, disabledColor); break;
            default: tc = TweenColor.Begin(tweenTarget, duration, mColor); break;
         }


The variable mColor is only set in the OnInit method and (at least to my knowledge) never updated afterwards.
Should this variable not be updated from TweenAlpha or TweenColor as well?
Am I getting something wrong here?
If not: Where do I have to change the code to solve the problem and not causing a terrible number of new bugs to occur?
If anything is unclear then please tell me. :)

Pages: [1]