Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ThatOwlGuy · Jan 13, 2016 at 04:15 AM · touchenumunityremote

Touch won't work outside of remote

I've made sure to keep all touch handling within update to avoid input conflicts and when i tested in Unity everything worked correctly. I don't require multiple outputs but when i started only looking for touch '0' didn't work (though that was just testing with builds so it's likely the same issue). Here is my Touch handler for the types of taps I want to distinguish from.
public class TouchHandler extends MonoBehaviour{ private static var tapTime : float;

     enum TouchType{NoTap = 0, Tap = 1, DoubleTap = 2, Hold = 3};
 
     public static var curTouch : TouchType;
 
     function Update(){
         if(Input.touchCount >= 1){
             for(var touch : Touch in Input.touches){
                 switch (touch.phase){
                     case TouchPhase.Began:
                         if(Time.time > tapTime){
                             tapTime = Time.time + 0.5;
                             curTouch = TouchType.Tap;
                         }else{
                             curTouch = TouchType.DoubleTap;
                             //print("DoubleTap!");
                         }
                         break;
                     case TouchPhase.Stationary:
                         if(Time.time > tapTime){
                             curTouch = TouchType.Hold;
                         }
                         break;
                 }
             }
         }else if(curTouch != TouchType.NoTap){
             curTouch = TouchType.NoTap;
         }
     }
 }


And here's the simple player movement script for moving around based upon the touches (It's for testing a cardboard vr game idea).

 public class PlayerMovement extends MonoBehaviour{
 
     public var speed : float = 2;
     public var moving : boolean;
     private var curForward : Vector3;
 
     private var cam : GameObject;
     private var rig : Rigidbody;
 
     private var tapTime : float;
     private var gettingTapType : boolean;
 
     /*enum tapType{noTap, oneTap, doubleTap};
     private var curTap : tapType = tapType.noTap;*/
 
     function Start(){
         cam = GameObject.Find("Main Camera");
         rig = GetComponent(Rigidbody);
     }
 
     function Update(){
         if(TouchHandler.curTouch == TouchHandler.TouchType.Hold){
             MoveForward();
         }
 
         var newForward : Vector3 = cam.transform.forward;
         curForward = new Vector3(newForward.x, 0, newForward.z);
 
     }
 
     /*function LateUpdate(){
         var newForward : Vector3 = cam.transform.forward;
         curForward = new Vector3(newForward.x, 0, newForward.z);
 
         //if(moving){ MoveForward();}
     }*/
 
     function MoveForward(){
         rig.velocity = curForward * speed;
     }
 }


It's all in js but I wouldn't mind a .cs solution if the logic ends up the same. Even if it isn't that just means I'll have to use cs which is a pain, but not impossible for me to do. Maybe I'll figure out what happens, but if you do instead, thank you~!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by ThatOwlGuy · Jan 03, 2017 at 07:41 AM

Turns out what was wrong is that the touches in this way is something recognized by iOS devices only. Not sure anyone else would look for this solution, but just in case...

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

35 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Double tap on iPhone very unreliable 2 Answers

Does Unity Remote 4 act the same as it would when it is on the app store? 1 Answer

Detect if input is from editor or Unity remote 1 Answer

How to distinguish between fast moving finger touches? 0 Answers

How add gyroscope to UnityRemote for iPhone? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges