Welcome,
Guest
. Please
login
or
register
.
April 30, 2026, 05:55:31 AM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Unexpected "Swipe" Performance on iOS
« previous
next »
Print
Pages: [
1
]
Author
Topic: Unexpected "Swipe" Performance on iOS (Read 2611 times)
Majicpanda
Jr. Member
Thank You
-Given: 0
-Receive: 0
Posts: 83
Unexpected "Swipe" Performance on iOS
«
on:
March 15, 2013, 10:19:31 PM »
Is there anything wrong with the following method to detect an object and process a method on the object called Clicked()? Basically what I'm seeing is fast swipe gestures across iPhone are not recording multiple objects hit in a row and sometimes not even a single object if the swipe is fast enough.
If the finger is moved slowly all objects are processed without any issues at all.
UICamera on my ortho game camera with mouse and joystick disabled, tried sticky keys enabled/disabled.
void
Update
(
)
{
//ensure game isnt paused before allowing clicking on the screen colliders
if
(
!
areaTimer
.
gamePaused
)
{
//if game is running on ios or android, get hovered object by simply getting whatever is hovered
if
(
isMobilePlatform
)
{
GetHoveredObject
(
)
;
}
//else require mouse button down to return the hovered object as a hit detection
else
{
if
(
Input
.
GetMouseButton
(
0
)
)
{
GetHoveredObject
(
)
;
}
}
}
}
//ray casting calls this to detect hit objects
void
GetHoveredObject
(
)
{
//if there is no hovered object, do nothing
if
(
UICamera
.
hoveredObject
)
{
hitObject
=
UICamera
.
hoveredObject
.
gameObject
;
//get the items clicked function depending on the tag and process the clicked method on the game object
switch
(
hitObject
.
tag
)
{
case
"Treasure"
:
hitObject
.
GetComponent
<
TreasureItem
>
(
)
.
Clicked
(
)
;
break
;
case
"Enemy"
:
hitObject
.
GetComponent
<
EnemyItem
>
(
)
.
Clicked
(
)
;
break
;
case
"EnemyProjectile"
:
//hitObject.GetComponent<EnemyProjectile>().Clicked();
break
;
default
:
break
;
}
}
}
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Unexpected "Swipe" Performance on iOS
«
Reply #1 on:
March 16, 2013, 09:22:52 AM »
Performance related, likely. Raycasts are done in Update, and if there are not enough updates, you won't see what was hit.
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Unexpected "Swipe" Performance on iOS