Trigger(Touch) not working anymore on Android Unity3D VR App - android

My Cardboard-like VR-Viewer has a button that works by touching the screen. I created an app in Unity3D and this trigger mechanic first worked like a charm. Now all of a sudden, I think I only added an explosion particle effect, the touch function stopped working completely. I have tried things like removing the explosion from my scene again, but nothing seems to work. Another curious thing is, that I can't close the app in a normal way anymore (normally in VR Apps you have an X-Button in the top left of your screen, but clicking it doesn't do anything anymore too (It used to work!)). App still runs, doesn't crash, but no interaction is possible. I looked at the debug logs via adb - no errors there... App works like it used to when I start it inside the Unity Editor.
Did someone encounter a similar error or may have an idea about what the problem is? I'm using Unity Daydream Preview 5.4.2f2.
Edit: I forgot to mention I was using GvrViewer.Instance.Triggered to check if the screen was touched.

For all having the same problem, I worked around it by also checking if a touch just happened. In my Player : Monobehaviour I used:
void Update()
{
if (GvrViewer.Instance.Triggered ||
Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Ended)
{
//Do stuff.
}
}

Related

ShowAchievementsUI(); don't want to appear on Android

I am using the official PlayGameServices plugin for Unity, and have been following the installation to the point. Authentication seems to work like a charm, but when I want to do the ShowAchievementsUI();, nothing happends. No UI, no errors, no crashes.
Ive been googling around for a while, it seems other people have hit this problem, but with no solution in sight.
My code at the moment is :
using GooglePlayGames;
using UnityEngine.SocialPlatforms;
void Start() {
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();
LoginSocialGamecenter();
}
public static void LoginSocialGamecenter() {
if (Social.localUser.authenticated) {
Social.ShowAchievementsUI (); Debug.Log("Pancakes!");
return;
}
}
And "Pancakes!" comes out perfectly. Authentication UI on first install also shows up nicely. It fails on all devices I have, but the debug message shows up perfectly on Android.
According to the documentation, it should work as described:
Showing the Achievements UI
To show the built-in UI for all leaderboards, call
Social.ShowAchievementsUI.
using GooglePlayGames;
using UnityEngine.SocialPlatforms;
...
// show achievements UI
Social.ShowAchievementsUI();
This will show a standard UI appropriate for the look and feel of the platform (Android or iOS).
Akhil got it right. There needs to be more than five achievements or the window won't appear.
It will make no error reports on this, simply return false.

flash air for android touch event DOESN`T WORK

I was trying to make something in Adobe Flash, Air for android. I simply made a square and converted it to an Symbol (called 'hello') and I entered this code.
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
hello.addEventListener(TouchEvent.TOUCH_TAP, tap);
function tap(event:TouchEvent):void
{
hello.x+=15;
}
but nothing happend. I even used CODE SNIPPERS, and also tested this on my phone(ALCATEL onetouch idol mini), and it also said that there are no errors.What have I done wrong?
You set everything correctly but forget only one important thing: check if the system supports touchevent.
if(Multitouch.supportsTouchEvent)

How do I use the touch in Flash AIR and AS3?

I am making a game which is simple to control, I have made it in AS2 and there I use
if (Key.isDown(1)) {
yspeed -= power*thrust;
}
so when user is holding the mouse click down the hero moves up, but in AS3 I can't seem to figure it out, I want to make the same game for android and iPhone so I made a new file as Android AIR and now I am programming in AS3 but I can't seem to find out how to do this, I've tried with
block.addEventListener(MouseEvent.CLICK, doSomething);
function doSomething(event:MouseEvent):void{
trace("Box has been clicked");
}
but when I go to test, and I turn on the "touch layer" noting happens, but when I turn it off and click on block is traces "Box has been clicked"
Do you set the input mode? I think this is the problem.
You can check the reference here (examples provided): http://help.adobe.com/en_US/as3/dev/WS1ca064e08d7aa93023c59dfc1257b16a3d6-7ffe.html

Touchmove & vmousover not working in a Cordova/PhoneGap Android app

I've tried both techniques in this answer to get a "dragging touch highlight" across elements in my PhoneGap App (testing on Android).
Here's my JSFiddle of the touchmove approach
$("td").bind("touchmove", function(evt){
var touch = evt.originalEvent.touches[0]
highlightHoveredObject(touch.clientX, touch.clientY);
});
Here's my JSFiddle of the vmousemove approach
$("#main").bind("vmousemove", function(evt){
$('.catch').each(function(index) {
if ( div_overlap($(this), evt.pageX, evt.pageY) ) {
$('.catch').not('eq('+index+')').removeClass('green');
if (!$(this).hasClass('green')) {
$(this).addClass('green');
}
}
});
});
Both work perfectly when emulating the app from desktop browser. Both work when viewing the JSFiddles from my Android tablet browser. But in the installed app on the tablet, it doesn't work. Instead of an updating highlight as I drag across the elements, all I get is a highlight on the first-touched event. The same for both methods.
Any ideas what's going on?
A comment on this question has an intriguing suggestion that "If you are running on android you also need to cancel the touchmove event to get new ones while touching. Don't ask me why...". Does that ring a bell, and if so, how would I "cancel the touchmove event to get new ones" with either of these approaches?
Alternately, has anyone successfully done a "dragging highlight" effect on a PhoneGap app, and would you care to share your technique?

Why do I get a strange blank screen error with OpenGLes/Android/NDK?

I'm getting a very weird error ever since I have "ported" the spritebatch code from Nokia's site. It runs well as a desktop applcation emulated by POWERVR. But on Android I only get a blank screen (in fact its black.) This happens if I just try to display a image, but it doesn't crash.
Here is where comes the weird part comes in: if i put glGeterror(); in the update function it works fine! (slowly, but displays everything fine) and geterror code returns 0. I have no idea what is going on or how to debug it, as I'm new to OpenGL but everything looks correct in the source. I spitted geterrors all around the code but without any clue. I've attached my project if you want to take a look. You will need Visual Studio + vsandroid to compile.
apparently the problem is not on the sprite batch, but in the java code. I replaced for another one that uses surface view and no longer im getting this esotheric behavior.

Categories

Resources