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

Pages: [1] 2
1
NGUI 3 Support / NGUI - Improving touch?
« on: April 18, 2017, 01:50:21 PM »
Under NGUI 3, what would be the best way to improve touch detection? I'm using the fallthrough and NGUI OnPress/OnClick in my main program to detect game clicks in a mobile game.

  1. UICamera.fallThrough = this.gameObject;


  1.    
  2. public void OnClick()
  3.     {
  4.         bool mouseClick = true;
  5.         DetectMouseClick(mouseClick);
  6.     }
  7.  
  8.     public void OnPress(bool isPressed)
  9.     {
  10.         DetectMouseClick(isPressed);
  11.     }
  12.  
  13.     public void MoveHitObject(RaycastHit hit)
  14.     {
  15.         hitObject.gameObject.transform.position = hit.transform.position;
  16.         hitObject.IsActive = true;
  17.     }
  18.  
  19.     public void DetectMouseClick(bool Pressed)
  20.     {
  21.         if (!enableGameClickTimer && !isPaused)
  22.         {
  23.             RaycastHit hit;
  24.             Ray ray = gameCamera.ScreenPointToRay(UICamera.lastEventPosition);
  25.  
  26.             if (Physics.Raycast(ray, out hit))
  27.             {
  28.                 MoveHitObject(hit);
  29.  
  30.                 switch (hit.transform.tag)
  31.                 {
  32.                     case "Ground":
  33.                     case "Brick":
  34.                         PurchaseBrick();
  35.                         break;
  36.                 }
  37.  
  38.             } else
  39.             {
  40.                 PurchaseBrick();
  41.             }
  42.  
  43.            
  44.             enableGameClickTimer = true;
  45.         }
  46.  
  47.     }

When either is detected, a ray is cast into the game world and an object moved to encounter other objects that the touch might have intercepted. However, my testers are reporting that
this only works roughly half the time. Touch seems to be spotty, but the game relies on it. What can I do to improve the odds that an object is detected properly?


2
To create the object on screen, I then add a sprite via the NGUI menu and select the sprite from the
atlas. However, only the outline of the UISprite placed object appears, but no sprite is visible in it.
When this bug pops up, it won't actually show ANY sprites in the new UISprite object - the new, or
previously existing sprites.

I don't actually add sprites by Alt+Shift+S, I add by "Add/Update" in the NGUI Atlas Maker.
I did not know about that shortcut.

3
Okay, let me try to clarify. The original post was written kind of late at night for me.

In my thoughts:
Graphics = Graphic files contained in the folder.
Sprites = Graphics added to the atlas itself.

I had a number of sprites that were no longer needed in my Atlas.
So, I deleted each unwanted sprite out of it, then saved. I was not aware there was a way to save the atlas
without saving the project itself.  After I deleted the sprites, I wanted to add one more graphic to the atlas.

The new sprite was added to the atlas successfully.

However, when I created a UISprite object within the GUI, and selected the new sprite in the atlas, it does not show
in either the Editor or the Game View - with or without Play enabled. In effect, no new UISprite objects can be placed,
while the old still retain their sprites correctly.

I am currently using NGUI Version v3.5.3.

4
I'm having an issue with my atlas where I've removed a number of older graphic from it. After deletion, if I add a new graphic to the atlas the new graphic does not show when added to the UI as a sprite. This applies to both the Scene and Game views, and if I change a new sprite to one already placed into the editor, the UISprite object still doesn't show anything. The only thing I can think of doing is rebuilding the atlas entirely, but I want to leave that as a last resort. On a note, this seems to start happening after five-ten sprites are deleted from the atlas.

5
NGUI 3 Support / Attaching 3D objects to 2D anchors in latest NGUI versions
« on: February 12, 2014, 08:16:33 AM »
Is it possible to link something like a 3D modeled coin to a counting label in order to create a spinning coin effect? In previous versions before the new anchor system was introduced I figured out ways to do so, but now trying the same thing results in the coin going way offscreen and not sticking where it is supposed to.

6
NGUI 3 Support / Re: Split radial guages
« on: July 21, 2013, 09:36:12 AM »
Slight bump, but got it working! Played around with everything and experimented. Built a completely custom widget using Radial 180, and added animation. Did notice an animation side effect. It forces the image to it's original sizes (unless you script for scaled animation?), however it works out in the end. I'm building this for a combination web, mobile, and eventual console down the line.

7
NGUI 3 Support / Re: Split radial guages
« on: July 21, 2013, 05:00:39 AM »
On the right side where the map is displayed, you can see a standard health/energy gauge. It's split down the middle and organized so it doesn't take up so much room. Would the Radial 360 work on a half-circle like that, or would I need another effect to pull that off? On a semi-related note, can I apply the NGUI Animation effect to a health bar/gauge?

8
NGUI 3 Support / Re: Split radial guages
« on: July 20, 2013, 07:03:29 PM »
Whoops! Fixed the original post with an attachment. Strangely it worked for me but failed for everyone else.

9
NGUI 3 Support / Split radial guages
« on: July 20, 2013, 01:30:36 PM »
I'd like to borrow the gauge effect from Snoopy Flying Ace (or maybe Torchlight 2), but I'm not sure if it's possible to do it.
Can NGUI display half-gauges like this?


10
NGUI 3 Support / Re: Skybox background flickering on Android
« on: May 29, 2013, 12:22:51 PM »
Tried using Mobile/Skybox.. so far no difference. Even set the alpha down to zero on main camera. My next try will be using a custom skybox.

EDIT: Changing over to a custom Skybox using Mobile/Skybox fixed the flicker. I'm not sure what was going on, can't imagine that the default test skyboxes would be too complex for Android o.O

11
NGUI 3 Support / Skybox background flickering on Android
« on: May 29, 2013, 01:03:59 AM »
I'm trying to set up an input field where I can type in a character name, but while it works, I've noticed that every single time a keypad button is pressed, the skybox flickers black. This isn't the only time it's happened. My game is currently set for a quick-play Portrait style display. When I set it to Landscape, the skybox stayed black. I'm using a standard Unity skybox at the moment, with alpha turned up to 255 on the main camera as suggested in another post. The main camera is orthographic.

Phone: Galaxy S3
Android: 4.1.2
Unity3D: 4.1.3


12
NGUI 3 Support / Re: Fading Whole Panels
« on: November 07, 2012, 01:56:30 PM »
I don't believe it. The simplest method worked. After trying the tween included with NGUI, then iTween and a few other things.. I did a "*.alpha += 0.01;". It ran perfectly.

13
NGUI 3 Support / Re: Fading Whole Panels
« on: November 07, 2012, 12:41:46 PM »
I've been trying that but not entirely sure what to use to change it within code. I did attempt an animation using the UI animation editor, but it only faded part in before stopping at a ghostly transparent stage.

14
NGUI 3 Support / Re: Fading Whole Panels
« on: November 07, 2012, 09:21:23 AM »
How do you use UIPanelAlpha?

15
NGUI 3 Support / Fading Whole Panels
« on: November 07, 2012, 03:33:18 AM »
I know this question has been asked before but I'm utterly stumped. I have two panels I'd like to fade in and out and switch, but I can't figure out how to do multiple types of widgets, custom or not. For example, one panel is a story panel. UISprite and UILabel. The other panel has several UISprites, UILabels, and a Progress Bar as well as a custom widget for inventory.

I don't want to do a hard snap because that never looks all that good when you're dealing with story elements. The goal is to fade in AND out using alpha.


Pages: [1] 2