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

Pages: [1]
1
NGUI 3 Support / onTooltip on disabled Buttons
« on: May 15, 2016, 08:07:13 AM »
Hey Aren,

in my buildmenu evey build´button has a tooltip and gets disabled, when the player can´t affort it. Disabling a Button the NGUI-way (so that the diffrent coloring works and such) means, that the collider gets disabled, which also will disable the tooltip.

How is this tooltip/disable buttons system meant to be used for such a case? Or do i need to build a workaround for it?

P.S.:
i just checked Winward. For the abilities menu i guess you are disabling those buttons not with button.isEnebaled = false, right?

2
NGUI 3 Support / Use premade Spritesheet to create an Atlas
« on: April 28, 2016, 04:20:43 AM »
Hello,

i have a premade texture with several sprites from my artist and i try to figure out oh to set it up as a texture atlas. I pretty much know what i need to do, except the options seem not to be available in the Atlasmaker tool, so propably i´m missing something here.

using:
Unity 5.3.3f1
NGU 3.9.8
NGU HUD Text 1.13

Here are my steps so far:

i importet the png as a texture, alphaIsTransparency checked, WarpMode clamped and truecolor as suggested here: http://www.tasharen.com/?page_id=120

i opened the atlasMaker created a new Atlas and setup the material using this very texture. Now i have one sprite to map out which i did. As stated here i should be able to setup more sprites and positions for that texture but i cannot find the button for it: http://www.tasharen.com/forum/index.php?topic=221.msg1090#msg1090

Also i get a console error. All my Settings and the error are on the attached screenshot

I also read up that it´s possible to import the sprite-positions using a txt file generated from some tool. Is there another way to generate that file or can i get an example of the layout of such a txt, so i can write my own and use it?

3
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.

4
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



5
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




6
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?

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

8
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]