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 - The-Arrival

Pages: 1 [2]
16
NGUI 3 Support / Add onTooltip to UIEventTrigger
« on: February 03, 2016, 05:15:35 AM »
Hey Aren,

is it possible to add onTooltip to the UIEventTrigger?

i want to pass something like the buttonindex to my UI-Class to show the fitting tooltip for each button. I found a workaround to use onHoverOver for this wich works, but to have the onTooltip event available in the class looks like a logical thing to me anyway.

17
NGUI 3 Documentation / Re: UIButton
« on: February 02, 2016, 05:31:10 AM »
Awesome. Thanks. I´ll wait until the changes are pushed to the Assets Store to update.

18
NGUI 3 Documentation / Re: UIButton
« on: January 27, 2016, 05:32:45 AM »
How do i only trigger the pressed state of a UIButton, when i click the left mousebutton?

by default a button and it´s remote method gets triggered by all onClick events which happens to be left, right and middle mousebutton clicks. I can easily make the remote trigger only on a left click using this:

  1. public void Button()
  2.     {
  3.         if (UICamera.currentTouchID == -1)
  4.         {
  5.             doStuff();
  6.         }
  7.        
  8.     }


But i have no idea how to trigger the UIButton components colorchange for "pressed" only for a specific pressed mousebutton, without changing the UIButton class itself.

19
NGUI 3 Documentation / Re: UICamera
« on: January 20, 2016, 07:13:56 AM »
Hello ArenMook,

is it possible to easy up your event system, by only implementing certain events in a trigger using interfaces? The Unity EventSystem provides Interfaces: Unity.EventSystem

I found this tutorial on how to only implement certain Events from the system: Tutorial

Is it possible to do something similar with your eventsystem?

Another thing i recognised is that while a mousebutton is pressed, no OnHover is getting triggered. Though for most cases this behavior is totally fine, is it possible to override you event-behaviors with a custom one?

20
NGUI 3 Support / Re: Issues with updating to 3.9.1 and importing HUDText
« on: September 18, 2015, 04:03:25 AM »
Works... thank you very much

21
NGUI 3 Support / Re: Issues with updating to 3.9.1 and importing HUDText
« on: August 30, 2015, 07:31:27 PM »
Hey again.

i updated to the new version (3.9.2) to check again for that mouse issue. It´s still there.

I also have no controller plugged in and i deactivated my controller drivers to make sure that nothing is bugging around here. I also check my input settings. There is one option in my MouseX/Y settings, which confuses me. JoyNum is "Get motion from all Joysticks" by default and never caused me problems with the older versions. On Change i only get the options to set it to a specific joystick, can´t say "no Joystick".

Where and how do i have setup the controlls behavior to resolve the issue?

22
NGUI 3 Support / Issues with updating to 3.9.1 and importing HUDText
« on: August 03, 2015, 07:23:15 PM »
Hello,

i run Unity 5.1.1f1
i recently tired to update my 3.8.2 NGUI Version to the latest 3.9.1 and also import HUDTExt 1.13 to an existing project.

I did as i should, new scene, delete NGUI Folder, import NGUI. No errors so far, but when i start the game i get weird mouse behavior. When i scroll the screen and have the cursor offset from the middle of the screen, it flickers and tend to jump to the middle while scrolling. This happens exactly when i do the upgrade. With the old version it's fine.

Also when i import HUDText (after having NGUI imported) i get the following compiler error:

Assets/NGUI/Examples/Scripts/Other/PlayIdleAnimations.cs(12,14): error CS0101: The namespace `global::' already contains a definition for `PlayIdleAnimations'

This happens, if i import HUDText to NGUI 3.8.2 or 3.9.1



23
Hello Forum,

i came up with this issue while having problems detecting if my mouse is on an UI-Element or in the 3D World. The mistake was, that i had a custom raycast-function going to detect what object in the 3D world the mouse is touching and ngui also does this, for his UI Elements. So i read a lot about it in this Forum and in the documentation and found the advise to use NGUI´s raycast, instead of custom ones, but up to this point i´m not getting how to achieve this.

What i think i got right (pls correct me if something is wrong):

- Having an UICamera on any ingame Camera means NGUI-Raycasts against the set layermaks.
- If those raycasts hit something, colliders or rigidbodys, you get access to the NGUI-Events like OnClick, OnHover etc in those gameobjects.
- If nothing on the set layermask is hit, you can forward the eventsystem to a custom eventhandler on any gameobject using UICamera.fallThrough = this.gameObject; You then have access to these Events in this GO.

For serperating UI-hits from 3D World hits, ArenMook suggested in an other thread the following setup (if i got this right, pls also correct):
- UI-Camera has for sure UICamera-Script, Event-Type set to 2D/3D UI, EventMask set to UI only
- Main-Camera has also UICamera-Script, Event-Type set to 3D-World, EventMask set to nothing

Is it possible that this setup is outdated, cause the current version gives a fallThrough in any case and the UICamera is not needed on the Main Camera anymore? The thread is from 2012: http://www.tasharen.com/forum/index.php?topic=138.0

Assuming that i got it more or less right up to this point i´m trying to use those fallThrough Events for detecting which gameObject in the 3D world was hit, without using additional raycasting. I have the UICamera-Script only on my UI-Camera , set to UI-only, rest of the hits fall through my EventHandler, though i also tried the setup with UICamera on MainCamera but it seems to make no diffrence.

My problems:

I need information what 3D-world, non UI GameObject was hit by the fallThrough event, like i would check it wth a raycast. All functions i tried so far didn´t provide this information or did i missed something?

- OnHover-Event seems to only trigger, when the fallThrough gets triggered, means when i switch from UI to non UI Element. It seems not to trigger constantly when i´m hovering over any 3DWorld colliders.

- UICamera.lastHit doesn´t give me the current hit Object
  1. public void OnClick()
  2.     {
  3.         Vector3 obj = UICamera.lastHit.transform.position;
  4.         Debug.Log(obj);
  5.     }              


It seems to refere to the 2D UI-Layer, cause all positions i get are like (a, b, 0)

I also have started a workaround using the fallThrough system only to check if we are on UI or not and then do some custom raycasting to check what i´m hitting in the 3DWorld, but if i got all the other informations right, this is not the way things should be done here.

thx in advance
Marcus




24
Thanks for the polite answer. Components and Objects are still confusing me from time to time.

25
Yeah, got it! I´m a beginner. Thx for this information. I asked also here about this, cause i thought there is maybe a build-in solution for something like this i didn´t recognised.

What about the second question about typecasting? Also too newbie-ish to get an answer here?

26
Update: The Listquestion got solved on the Unity-Forums using this solution:

  1.    public List<enemyLabel> enemyLabels;
  2.  
  3.     [System.Serializable]
  4.     public class enemyLabel
  5.     {
  6.         public UILabel label;
  7.         public bool isUsed = false;
  8.     }

So i´m still struggeling on the NGUI specific typecast issue, or another way to auto-add my labels to my List or maybe better create a new lable on runtime, if i run out of premade labels.

27
Hello Community
i´m looking for a way to create a List/Array of a class connected to a bool variable to keep track if it´s used or not.
I´m working with NGUI v3.7.9
So i´m having a Debug-UI running were i can track values of every unit in game. Since i´m implemented a spawner for them i have to find a way to attach a not-used UI-Label to a spawned enemy. When he dies the label can be used by another one.
In the inspector i´m adding all available Labels in this list:
  1. public List<UILabel> enemyLabels;
Now i would like to connect a bool to every entry set to false. When the label is assigned change it to true, when the unit dies, set it back to false again and make the label available. Is something like this even possible?

The other question is this:
Instead of adding the available labels in the inspector i would like to add them automaticaly. I tried something like this:
  1.         uiRoot = GameObject.Find("UI DebugLabels");
  2.         for (int i = 0; i < uiRoot.transform.childCount; i++)
  3.         {
  4.             Transform temp = this.uiRoot.transform.GetChild(i);
  5.             UILabel tempLabel = temp as UILabel;
  6.         }
But i couldn´t find a way to typecast my transform into UILabel. Does anyone knows a better way?

28
NGUI 3 Support / Re: UISprite and drawing issues
« on: November 14, 2014, 12:42:45 PM »
Unfortunately I'm using the free version right now. Sorry, i recognised too late that this forum is only for the standart version.

I'm about to buy myself into the standart version to make it up for my misstake (and because this plug-in is great) :)

So I'm waiting with my other question concerning my problem (and your answer) until i have it.

By the way, i got the method i tried before from this tutorial and in my mind i made totally sense :)

http://cgcookie.com/unity/lessons/3a-turret-placement-hud/

29
NGUI 3 Support / NGUI Licenses and NGUI HUD Expansion
« on: November 14, 2014, 12:35:30 PM »
Hello Community,

I'm working on a game together with two other persons (so we are three), two of us are actually coding in Unity, the other one is making Assets for the game. I started with the free Version of NGUI and I'm looking forward to buy the standart Version (and maybe the HUD-Expansion if needed).

The problem is, that this is a hobby-spare-time project and my other programmer is short in money so he can't afford it at the moment. So is it possible to work on the same project, if i buy NGUI and do all the NGUI related coding, can he still work on other parts of the same project without having the standart version? What are the actual restrictions, if one person has the standart version and the other one hasn't?

The other question is: I'm planing to have UI-Elements bound to in-game 3D Objects, when clicked (like a build menu, when you click on a build spot for example). As far as i understood it this is only possible with the HUD-Expansion, right? Or can it be done with the standart version too?

30
NGUI 3 Support / UISprite and drawing issues
« on: November 09, 2014, 08:17:13 AM »
Hello,

I'm having issues with my UI-Setup. I'm pretty new to Unity and NGUI so expect some noob-mistakes and try to answer in easy words :)

I wanna have a build menu with blue buttons and the one selected should be orange. If i start the game, the buttons don't get colored or depending what i set as structureIndex, don't get drawn at all.

My Setup is like this:

I set up two buttons for testing. The Sprites linked to the buttons are set to "Sprite Type: Sliced" and "Fill Center: checked" by default in the Inspector. I colored them both in white, cause i wanna set the color through my build-menue script.

The Script ( i just posted the parts concerning the UI issue):

public Color onColor;
public Color offColor;
public UISprite[] buildBtnGraphics;
public int structureIndex;
   
void Start ()
{
   structureIndex = 1;
   UpdateGUI ();
}

public void UpdateGUI ()
{
   for (int i=0; i==buildBtnGraphics.Length; i++)
         {
        buildBtnGraphics .color = offColor;
     }

   buildBtnGraphics [structureIndex].color = onColor;
}

So the variable buildBtnGraphics is giving me an Array in the Inspector, where i can drag´n´drop the sprites in. I tired to use UISlicedSprite[] here, but then i couldn´t drag´n´drop anything in. This is the first thing i can´t get my head around. Why can´t i use UISlicedSprite[] here, if "Sprite Type" is set to sliced. I also tried to set the "Sprite Type" to "simple", but it didn't change anything.

So whenever the player clicks a button, the structureIndex is set to whatever is clicked and the UpdateGUI function is called. The UpdateGUI function should draw every element in the UISprite-Array to the offColor and the one selected (structureIndex) to the onColor.

Funny fact: Both Buttonsprites seem to get treated differently. If i set structureIndex to 0 (first sprite), everything is drawn in white and in the inspector of the sprite (during runtime) no orange is applied. When i set it to 1 (second Buttonsprite), the button is not drawn at all, but in the inspector i see, that the orange color is applied to the button.

So it seems that the hole problem is down to the Sprite-Types (sliced or not?) and how to set them up properly, but i can't figure it out


Pages: 1 [2]