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

Pages: [1] 2
1
NGUI 3 Support / Re: NGUI Box Collider keeps resizing
« on: October 24, 2015, 08:14:08 PM »
I found the problem

Under the UI Sprite widget property in the inspector panel, there is a tick box which says

collider - auto adjust to match

Just tick that off and you are good to go.

2
NGUI 3 Support / NGUI Box Collider keeps resizing
« on: October 24, 2015, 07:13:48 PM »
Hi Guys,

I want to increase the box collider around my button.
But When I increase the size and reload the level, the collider keeps shrinking down to fit the button again rather than maintain the size I have set.

Is there anyway to override this?

3
NGUI 3 Support / Gaps in Texture and alignment issues
« on: August 20, 2015, 10:59:03 PM »
Hi,

I created an atlas for NGUI based on the asset UI Builder from the store (currently only supports IGUI). But I noticed that this is this strange transparency border around the images.

The other problem is I can't get elements to align properly. So in some cases there is a gap when there shouldn't be and in other cases there is overlap of widgets when they should be snapped aligned and not overlapped. The sprites also don't fill some of the widgets fully even when anchoring used and they are just sqaures.

Any help would be greatly appreciated  :)

I have attached an image I hope explains.


4
Hi,

I tried to use the grid and table components to layout my sprites and other gui elements but I cannot seem to get it to work.

I have watched this video:

https://www.youtube.com/watch?v=UK3aMHRfgcw

I had some success with using progrids plugin from the procore bundle but I just wanted to double check if I was missing this feature within NGUI.

https://www.assetstore.unity3d.com/en/#!/content/4466

5
Other Packages / Re: NGUI: HUD Text clear function
« on: July 28, 2014, 02:29:57 AM »
Thanks,

I will try that. I have been turning off the parent GameObject but that wasnt working.

6
Other Packages / NGUI: HUD Text clear function
« on: July 25, 2014, 11:17:29 PM »
Hi Guys,

I just wanted to know if there was a way of clearing text from the package addon HUD Text.

Thanks,
Jonathan

7
Thanks dude,

By following your logic I was able to get it working and also get it working in playmaker :D

Thanks for you help.

8
Thanks for the reply.

It doesn't have to be in playmaker. If I can figure it out in c# i can later convert it to a playmaker action.

I just seem to have issues of getting the text to update/increment over a certain time. I also want to stop the increment at the press of a button or have it decrease from a number.

So it would go 1-4 over 4 seconds; pause at 5 for 2 seconds; then go 4-1 over 4 seconds. This is an example of what I am trying to  do.

As I said, if I can get it working in c# with delta time I would be happy.

9
Hi guys,

Thought I would give this a bump.

What I am trying to do is create a script that I can give it a counter - say 1-10. And have a variable that adjusts that time. So the numbers will get displayed if its 5 or 10 seconds. The only thing that changes is there speed.


10
Other Packages / HUD Text Timer / point scale for cooking mini game
« on: June 07, 2014, 05:50:11 AM »
Hi Guys,

I am trying to create a custom script for playmaker that will have points increase over time and display it via the HUD Text plugin.

So I would have 3 states in playmaker.

#1 would go +1 +2 +3 +4
and you would exit out of this state via a wait action

#2 would have the +5 pause for a few seconds to allow people to get the optimum score

#3 would start taking away points +4 +3 +2 +1

Hope this makes sense what I am trying to do. Basically there is a cooking mini game and I am trying to show the points above the food. You get less time if you take it out too soon or too late.

  1. using UnityEngine;
  2.  
  3. namespace HutongGames.PlayMaker.Actions
  4. {
  5.         [ActionCategory(ActionCategory.ScriptControl)]
  6.         [Tooltip("Call Add of HUDText.")]
  7.         public class HUDTextNumbers : FsmStateAction
  8.         {
  9.                 [RequiredField]
  10.                 [CheckForComponent(typeof(HUDText))]
  11.                 public FsmOwnerDefault gameObject;
  12.                
  13.                 public FsmFloat value;
  14.                 public FsmFloat addValue;
  15.                 public FsmFloat results;
  16.                 public FsmColor col;
  17.                 public FsmFloat timeBeforeNextText;
  18.                 public FsmFloat timeBeforeFade;
  19.  
  20.                 private float timer;
  21.                
  22.                 public override void Reset()
  23.                 {                      
  24.                 }
  25.                                
  26.                 public override void OnUpdate()
  27.                 {
  28.                         // check that we have MyScript referenced
  29.                        
  30.                         GameObject      go  = Fsm.GetOwnerDefaultTarget(gameObject);
  31.                        
  32.                         if (go == null)
  33.                         {
  34.                                 return;
  35.                         }
  36.                        
  37.                         HUDText hudtext = go.GetComponent<HUDText>();
  38.                        
  39.                         if (hudtext == null)
  40.                         {
  41.                                 return;
  42.                         }
  43.                        
  44.                         timer += Time.deltaTime;
  45.                        
  46.                         if (timer >= timeBeforeNextText.Value)
  47.                         {
  48.                                 timer = 0f;
  49.  
  50.                                 results = value.Value + addValue.Value;
  51.                                 hudtext.Add(value.Value + addValue.Value,col.Value,timeBeforeFade.Value);
  52.                         }
  53.                 }
  54.                
  55.         }
  56. }

11
NGUI 3 Support / Re: NGUI custom input settings
« on: April 28, 2014, 06:00:53 AM »
Hmm,

I did try and use this:

  1. Input.anyKey

But it doesn't seem to work. I try and store the results of a key press with:
  1. storeResult = Input.inputString;

I did find this link:

http://issuetracker.unity3d.com/issues/input-dot-inputstring-works-differently-on-windows-and-on-mac

So maybe there is a bug in Unity itself. The only other option I can see is to use events.

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Example : MonoBehaviour {
  5.     void OnGUI() {
  6.         Event e = Event.current;
  7.         if (e.isKey)
  8.             Debug.Log("Detected a keyboard event!");
  9.        
  10.     }
  11. }
  12.  

I noticed you do something similar in UIInput.cs
  1.        
  2. /// <summary>
  3. /// Unfortunately Unity 4.3 and earlier doesn't offer a way to properly process events outside of OnGUI.
  4. /// </summary>
  5.  
  6. void OnGUI ()
  7. {
  8.         if (isSelected && Event.current.rawType == EventType.KeyDown)
  9.                 ProcessEvent(Event.current);
  10. }
  11.  

I think I am just tripping myself up. What I am trying to do is get it working with playmaker and NGUI. But it might be easier to piggy back off of NGUI via a C# script. Would the easiest solution be to duplicate the UIInput.cs file. Edit the contents, so that when a user presses a key. The child UILabel.cs file is updated with the key name. Multiple key presses would also just change the key name being displayed in the UILabel. Thus allowing me to have a custom input script for not only this game but further ones.

Am I on the right track?

Once the key is displayed correctly in the UILable. I can then retrieve it, store the value in a string in player prefs. Then using the keycode method in my code, I can check against the strings stored value when a key is pressed for custom controls.

12
NGUI 3 Support / Re: NGUI custom input settings
« on: April 25, 2014, 07:52:07 PM »
What I want to do is allow custom controls like in league of legends or first person shooting games.

So:

Forward - w
Back - s
Left - a
Right - d

But allow the user to click on the NGUI text field and press a key on the keyboard. Then the keycode for that key is stored in the NGUI textfield. So not having the user type out words/message but just allow them to enter one key and display the results.

Does this make sense? So if they press the spacebar. The keycode would then be put in the textfield. I could then store the textfield as a string in player prefs which I could then use to update the controls for the game.

13
NGUI 3 Support / NGUI custom input settings
« on: April 25, 2014, 03:56:53 AM »
Hi,

I want to create a custom settings menu with NGUI to allow the user to change the standard controls to whatever they like.

Is there a way in NGUI to list all the keycode so I can then store it in a player pref.

I know I could do it through an input text field, but im worried if they type the wrong keycode in and break the controls.

Thanks for your time guys.

14
Hi dude,

I tried using the script but it didnt work.

I can understand what you mean by it being tricky if you have a main camera and a ngui camera. Due to how they draw elements or order of draw. So just to clarify, I am using two cameras - one for unity sprites and the other for ngui gui's.

It seems that what I have to do is create a 3rd camera to act as a background camera for  drawing the background image. I could try moving all the elements into the ngui system i guess. Which would then allow me to use the depth draw call.

So my options are:

1) 3 cameras.
or
2) one camera which is ngui to draw everything.

15
An update to NGUI fixed the grayed out box issue. But I am still trying to figure out how to get the texture to show up behind the unity2d sprites

Pages: [1] 2