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

Pages: 1 [2]
NGUI 3 Support / BoxCollider does not stop Input in 3.X
« on: October 21, 2013, 04:27:46 PM »
Hey there,

so in order to stop Input on Buttons (and other stuff) I created in my a "STOPINPUTCOLLIDER" which is a GameObject with a Transform and only a BoxCollider; set to Trigger.
I change his Center.Z value like I want to certain values, most the time it is set to -15 so no button on screen (which have center.z values from 0 to  -10) can be touched.
This worked great for me.

NOW in 3.X I'm experiencing some weird stuff with this method. It kind of works in a different, weird and for my purposes not userfriendly way. It doesn't matter if I change the Value of the center.z, Buttons can be pressed. I managed to find out what the problem was. The Depth of the Background-Sprites of the Buttons.
When set to 0 or something negative the STOPINPUTCOLLIDER works, but as soon the Depth-Value of some sprites are set to 1 or above, the STOPINPUTCOLLIDER is ignored and every button can be touched.

Is there a solution to that or a workaround?

NGUI 3 Support / Prevent second Buttonpress
« on: August 28, 2013, 12:01:38 PM »
So I have a button and when this button is pressed it's playing a certain Animation (2DToolkit), but when the button is pressed again, the animation starts again before the last cycle of the animation could end.

Is there a way to prevent more input on the button till the moment the animation is done playing?

Hey there.
So when I create an ImageButton I have to select for each Status of the Button (Normal, Hover, Pressed, etc.) a Sprite. Fine.
But when I'm adding it to the Panel in the Scene it's showing a different Sprite in the Scene, normally the first Sprite of the NGUI-Atlas. In the Inspector it shows me the Sprites I selected in the Widget Tool Editor, in order to get the results I want, I have to select the Background-Object of the ImageButton and reselect the Sprite I want.

Is this behaviour intended? I'm using the latest nGUI-Version which is provided by your private link.

NGUI 3 Support / "Releasing" ButtonInput?
« on: June 15, 2013, 04:58:59 PM »
Hey there!

I have problems changing from one animation to another while pressing buttons, here is the scenario:

1. The character walks around (walking animation) - pressing the Movementbuttons
2. An Enemy appears
3. Character walks into Enemy and is hit (hit animation) - pressing STILL the movementbuttons, while the hitanimation is played
4. Character is stuck in the hitanimation and "walks" with this animation, till I release the Buttons.

The movement and animation is done by a script with an "OnPress"-Method, the Rest (getting Hit by Enemy etc.) is done in PlayMaker.
I wanted to tackle it like this:

- while the Movementbuttons are still pressed and the Player gets hit <-> in that State where he gets hit I wanted to "disable" or "release" the Button internally. Is this possible, if so: how? :)

NGUI 3 Support / Disabling JUMP-Button after Jumping
« on: May 26, 2013, 09:04:57 AM »
Hey there.

So I've got this Movement/Action-Script which is attached to all my four UIImage-Buttons. They are seperated in four different states and do their job well.

  1.     using UnityEngine;
  2.     using System.Collections;
  4. public class TestButton : MonoBehaviour
  5. {
  6.         public ButtonType type;
  7.         public NGUIInput input;
  8.         public RaycastCharacterController controller;
  9.         public tk2dAnimatedSprite playerSprite;
  10.         public SpriteAnimator animator;
  11.         public GameObject weapon;
  12.         private bool attacking = false;
  14.         void HitCompleteDelegate (tk2dAnimatedSprite sprite, int clipId)
  15.         {
  17.                 if (!playerSprite.IsPlaying ("attack")) {
  18.                = false;
  19.                 }
  21.                 if (!attacking) {
  22.                         CheckDirectionIdle ();
  23.                         playerSprite.Play ("idle");
  24.                 }
  26.                 if (animator.jumping) {
  27.                         playerSprite.Play ("jump");
  28.                 }
  30.                 if (animator.walking) {
  31.                         playerSprite.Play ("walk");
  32.                 }
  33.         }
  35.         void Start ()
  36.         {
  37.        = false;
  38.         }
  40.         void Update ()
  41.         {
  42.                 if (playerSprite.IsPlaying ("jump"))
  43.                         CheckDirectionIdle ();
  44.         }
  46.         public void OnPress (bool pressed)
  47.         {
  48.                 if (pressed) {
  49.                         switch (type) {
  51.                         case ButtonType.LEFT :
  52.                                 input.SetX (-1f);
  53.                        = false;
  54.                                 playerSprite.animationCompleteDelegate = HitCompleteDelegate;
  56.                                 if (playerSprite.IsPlaying ("attack"))
  57.                                         playerSprite.Stop ();
  58.                                 animator.walking = true;
  60.                                 break;
  62.                         case ButtonType.RIGHT :
  63.                                 input.SetX (1f);
  64.                        = false;
  66.                                 playerSprite.animationCompleteDelegate = HitCompleteDelegate;
  68.                                 if (playerSprite.IsPlaying ("attack"))
  69.                                         playerSprite.Stop ();
  70.                                 animator.walking = true;
  71.                                 break;
  75.                         case ButtonType.JUMP :
  76.                                 input.Jump (true);
  77.                        = false;
  79.                                 playerSprite.animationCompleteDelegate = null;                         
  80.                                 break;
  84.                         case ButtonType.ATTACK :
  86.                                 if (!playerSprite.IsPlaying ("attack")) {
  87.                                         playerSprite.Play ("attack");
  88.                                = true;
  89.                                         attacking = true;
  91.                                         playerSprite.animationCompleteDelegate = HitCompleteDelegate;
  92.                                         CheckDirectionAttack ();
  93.                                 }
  95.                                 attacking = false;
  97.                                 break;
  98.                         }
  99.                 } else {
  100.                         switch (type) {
  101.                         case ButtonType.LEFT :
  102.                                 input.SetX (0.0f);
  103.                        = false;
  105.                                 break;
  106.                         case ButtonType.RIGHT :
  107.                                 input.SetX (0.0f);
  108.                        = false;
  110.                                 break;
  111.                         case ButtonType.JUMP :
  112.                                 input.Jump (false);
  113.                        = false;
  115.                                 break;
  116.                         case ButtonType.ATTACK :
  117.                                 input.SetX (input.x);
  119.                        = false;
  121.                                 break;
  122.                         }
  123.                 }
  124.         }
  127. public enum ButtonType
  128. {
  129.         LEFT,
  130.         RIGHT,
  131.         JUMP,
  132.         ATTACK,
  133. };

The Problem is the JUMP-Part.

When I press that Button the Character is jumping. Fine. But when I press and HOLD it, the Character is jumping all the time with no change in other States, and of course the Animation is "stuck" in the last frame of the Jump-Animation. What do I want to do:

Is there a way to stop or disable the input of nGUI, meaning: the Player presses and HOLDS the Button, the Character jumps BUT stays grounded after that and the Player has to release the Button and press again.

Thanks in Advance for the Answers :)

NGUI 3 Support / Screenresolution on iOS-Devices
« on: May 04, 2013, 07:21:22 AM »
Hey there!

So I looked up this tutorial video:
which is well made and gave me a better understanding of the work with the resolution on the devices.

So I made a UI with the same Hierarchy and set the UIRoot-Scaling Style to "PixelPerfect"

I followed the tutorial and made a Hierarchy like this:

Here is the SceneView:

So the first resolution is the "iPhone 4G Wide (960x640)"  (all the Assets were made with this Ratio in mind!)
The Game-Scene looks like this:

That's the way it should like on the 4G Device.

But, if I switch to "iPad Wide (1024x768)", it looks like this:

I get this "gaps". I would suggest this is normal according the ScalingStyle is set to PixelPerfect. So I changed that Style to "FixedSizeOnMobile" and got this nice result with the "iPad Wide (1024x768)":

BUT then I switched back to the "iPhone 4G (960x640)" Setting and got this:

Like in "PixelPerfect" with the iPad Setting it's the same gap now in "FixedSizeOnMobile" with the iPhone 4G.

What do I have to do in order to get it right in every Landscape/Wide-Resolution?

NGUI 3 Support / Labels on different Layers legitimate?
« on: April 20, 2013, 06:54:32 AM »
So i want to use the nice Labels outside of the UI I made with nGUI.

So first i did this:

- Since i couldn't chose in the Widget-Tool the parent i wanted to  I made an empty GameObject and attached the UILabel-Component to it. Didn't had any effect, i could write something in the Textbox, but it didn't showed up in the Scene/Game-View.

Then i did that:

- i choose the UI-Panel on the GUILayer.
- created a Label with the Panel as Parent
- worked (of course)
- then i took the Label, made it a child of another gameobject outside the UI, changed the Layer of the Label
- worked
-> i can edit the Text and work with all the Settings (Outlines, Pixel-Perfect, etc.)

So: is this okay or will there be some problems concerning the Layers and the UI Behaviour?

And another question:
After some Minutes in the Widget Tool i could choose the Gameobject i wanted first to use as Parent? Why is that? Why couldn't i use it in the first place? And for some reason i only can choose that certain object and the panel. I can drag and drop the hell out of any other gameobject, it only works with that certain Gameobject and the Panel, of course.

By the way: i am using nGUI 2.3.4 (at least, that's what the ReadMe in the Project tells me) -  I bought the Package here at your website and not via the AssetStore. Are there some Updates yet?

NGUI 3 Support / UISpriteAnimation, how to?
« on: March 17, 2013, 12:50:04 PM »
Hey there.

I can't manage to animate my UI Sprites. There is one Sprite i want to animate (contains of 4 Frames)
How exactly can i do this with the UISpriteAnimation-Script? I am attaching it and when i play it, it cycles through my whole TextureAtlas.

NGUI 3 Support / ImageButton Scale On Hovering
« on: March 09, 2013, 09:11:45 AM »
Hey there,

got again a weird problem with my Buttons. This time, there is no other plugin involed, just nGUI:

When i hover above my Buttons, they get bigger, meaning, that the Background-Sprite is changing it's values when i hover above them (Mouse and Finger), and i don't know why.

I have to mention, that the UIRoot-Object is a Prefab, don't know if that helps.

Edit: I wanted to mention, that they stay that way until i end the "Play"-Mode.

Second Question -

Why does nGUI make my Sprites bigger then they are when i click "Make Pixel-Perfect". I have a Sprite which is "249x264". When i create the Widget as a Sprite it comes out as "498x528" and stays that way, even if i hit "Make Pixel-Perfect", but i want it to stay in its original ratio. How can I accomplish that?

NGUI 3 Support / ImageButtons Scale themselves after Statechange
« on: March 07, 2013, 04:30:35 PM »
Hey there, i am using nGUI and PlayMaker in order to achieve some things.

Now, i have this ImageButton here:

(normal and hover)

When the game starts, i can press the Buttons, everything is fine. When i press my PAUSE Button, it activates it's FSM and does some stuff, in short: it disables the UI-Behaviours of all other ImageButtons, so the User can't touch them anymore. (I am disabling the UIImageButton-Script!). After Pressing the Button again it enables the Behaviours again. This works well, too.

When i press the Button it changes it's Background, what's fine, since it goes to Pressed-State by nGUI itself.

The Problem is a certain situation: When i press the Button and HOLD it, while doing so pressing the Pause-Button, the UIImageButton-Script is disabled, and the Button stays in its Pressed-State. After pressing the Pause-Button again to enable the Button-Behaviour, the ImageButtons Scale goes up in the Scene and the Game, but in the Transform of the GameObject the values don't change, in the Background-Sprite itself nothing changes, too:

When i press the Button again it goes back to it's regular size, but again, the value don't change in the Inspector.

Any ideas?

NGUI 3 Support / UI strange behaviour on iOS Device
« on: March 05, 2013, 02:54:48 PM »
Hey there, so i got another Problem. I made my UI with nGUI. I have two cameras, a Main Camera and the UI-Root-Camera.
The UI has some Buttons, which have some Actions (PlayMaker). Now, the thing is, when i test the UI in Unity, everything works fine, but when i Build and Run it on my Device (iPhone 4) i have some strange behaviour. I made a little Video, so you guys can see what i mean:

- When i Press the Button in the right Corner (the Pause Button), then another UI Item shows up. That's fine, this is made by Playmaker.
When i press the first ImageButton on this UI-Item, this Item goes back to his originpoint, that's fine, too. BUT, the Problem is...well, you could see it, it just makes an infinite scroll loop.

The fun thing is: I debugged every action i made, and when the UI Item is back at it's origin it is deactivated, so it CAN'T be running, there has to be something strange about my UI(Settings).

- when i press the Buttons (which are ImageButtons btw), they get a blue "glowborder" around themselves and i don't know why. It doesn't look like that in the Unity-Editor, there the behavior is totally normal, just like i want to.

EDIT: I get this behavior now also in the Unity Editor, but ONLY when the GameView is set to "Free Aspect".
I made some Screenshots, so you can spot the Difference:

Free Aspect:

When i push the Pause Button the MenuItem comes up nice...

when i Push the Button on the MenuButton it goes back down, but this happens.

iPhone4 Wide:

And here the "proper" versions.

Besides, the FreeAspect Version is way more pixelated. And when i Build&Run the Game it comes out like the Free-Aspect Version with its pixelated UIItems and that strange behaviour.


Another problem occured...this is not my day...
I have this sprite:

Somehow it looks different, it's transparent, but it should look like this:

Last time i checked (1 hour ago) there wasn't any transparency on it, and i don't know how to change that. Tried to make a new Sprite, selected the same Atlas, the same .psd-file. Same result.

I really don't know what i messed up  :'(

Could anyone help please :/

NGUI 3 Support / Two Cameras - UI doesn't react any more
« on: March 04, 2013, 02:22:23 PM »
Hey there,

so today i worked on my UI with nGUI. The setup was pretty fast, managed to make som certain FSM with PlayMaker.
I have some ImageButtons and other things, not so import to mention. The Problem is: After building the UI i made a seperate Camera, which will be the Main Camera, where the rest of the game will be rendered.

So, i made a special layer for the nGUI-UI and called it "GUILayer", selected the UI and changed all the Children (Anchor, Panels, etc.) Layer also to "GUILayer". In Fact, here is a picture of the settings:

And here are the settings of the Main Camera:

Now, the two cameras render properly, but the problem is: I can't touch the buttons, neither with the mouse nor with my finger.
If i set the UI-Cameras Layer to "Default" and the Culling Mask to "Everything" it works again (Clear Flags is still set to "Depths only").

The funny thing is, i have a TestProject with the exact same settings and there it works. I just don't get it. Where is my mistake?

NGUI 3 Support / PauseController problems with nGUI
« on: February 14, 2013, 09:55:20 AM »
Hey there,

so i was looking for a clever way pausing my game. My GUI is setup with nGUI, which works quite well, for starters i used timeScale = 0 to pause some movement, but then i found this plugin:

Before i bought it, i read a review in the asset store, that there is a Problem with nGUI, because of a certain script. Apparently nGUI and PauseController have to identically named scripts and don't work together, the file in PauseController is called "Spin.cs".

Did someone used this Plugin and experienced some problems? I wrote a message to the developer of PauseController a week ago, but he didn't answer.
Is there a way to solve this problem or another decent Pause-Solution that works well with nGUI?

NGUI 3 Support / Permanent Button-Action
« on: January 10, 2013, 07:21:25 AM »
Hey there.

So i have these UIImageButtons, where i can move my Character through the Level. The Level and the character have some physics (FarseerUnity-Plugin-Physics, static Level, dynamic Character). With the Buttons i am controlling the dynamic Body of the Character.

So, for some testing i also have within an Update()-Method same actions, but only with Keyboard-Events, like this:

  1. if(Input.GetKeyDown(KeyCode.RightArrow))
  2.                 {
  4.                         float velocityScale = 2.5f;
  5.                         velocity.Y = KnightShape.LinearVelocity.Y;
  6.                         velocity.X =  velocityScale * m_normal.X;
  8.                         KnightShape.LinearVelocity = velocity;
  10.                 }

So, my problem is, that via Touch the results aren't the same like on the keyboard. When i press the right arrow and hold it, the character moves all the way to the right till i release my finger from the RightArrow-Key. I tried every meaningful nGUI-Event (OnClick, OnPress etc.), but nothing worked, he just moves with the VelocityScale to the right and stops, so i have to press/click the button all the time to get the character moving.

What am i doing wrong?

NGUI 3 Support / [nGUI]Some Problems with relative Size
« on: December 24, 2012, 09:44:29 AM »
Hey there,

i bought nGUI recently and fooled a little bit around in a new test scene. Now i want to built the GUI in my existing iPhone-project.
I have to cameras (a Main Camera and Parallax Camera for the Scrolling-Effect) with both a size of 3.2 (in order to make my other Sprites pixel-perfect).

Now i just made another Layer called GUI for the UICamera when i made a "New UI" via the nGUI-Menu. The size of the camera is 1, which looked fine to me at first, but then i started making my Interace-Objects.

First i made an TextureAtlas with all the .PSD Files.
(At this point i have to say: i really like the workflow of nGUI! I didn't have to look in the documentation and figured the most functions out by the nice structure of this plugin. That is great!)

And then i'll start adding the stuff i need, and now i got some problems with the Size and i can't handle it properly:

So here is my UIRoot-Object with the Anchor, the Panel, and an UISprite in the Scene and Game-View:

As you see, in the Game-View it's looking how i want it, but nGUI works the other way :D
It's about the Scene-View, and so i get this, when i play it:

I don't know which settings to manipulate and would be very grateful for some help, because i really really like the workflow of that plugin and want to work properly with it.

Pages: 1 [2]