Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by KemoM · Jun 11, 2015 at 01:47 AM · android2dvibration

Handheld.Vibrate() not working

I want to make my phone vibrate when two objects collide (2d game), so i tried this:

using UnityEngine; using System.Collections;

public class Vibrate : MonoBehaviour {

 void OnCollisionEnter2D(Collision2D collision){
     if(collision.gameObject.tag=="myTag"){
         Handheld.Vibrate();
     }
 }

}

but it is not working.

Comment
Add comment · Show 1
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
avatar image abi-kr01 · Jun 22, 2015 at 01:51 PM 1
Share
 try 
      if(collision.gameObject.tag=="myTag")
         {
          print("vibrate now");
          Handheld.Vibrate();
      }


see if you get that print first then move forwrd

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by KemoM · Jun 22, 2015 at 02:10 PM

Found a solution - so, if anyone has the same problem as I had here goes:

  • you need to build and run, or make an apk file and it will work. Unity Remote doesn't allow vibrate if you just press play.

  • also - game doesn't look as good on the mobile if you just press play, but if you click build and run it will look the way it should.

Basically, it is a Unity Remote issue.

Comment
Add comment · Show 2 · 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
avatar image Bunny83 · Jun 22, 2015 at 02:18 PM 0
Share

You didn't even say that you're testing with the Unity remote app. This app (Unity Remote) is nothing but a remote control for the editor. The game actually plays in the editor. The app just routes input from the device to the editor and transfers a video stream to the device which is displayed there.

You should read the docs on the remote app. Also note the "Troubleshooting" section at the bottom.

When using Unity Remote you also can't use native plugins since you don't actually run your application on the device. As said it's just a remote control for the editor. You can only use things the remote app supports.

avatar image KemoM · Jun 22, 2015 at 02:28 PM 0
Share

Forgot to mention I was testing it using Unity Remote, this is my first game and I'm still trying to find my way around :)

avatar image
0

Answer by StroBerri · Jul 21, 2021 at 09:34 AM

I have that problem. Tho the solution in mine was I changed the void from private to public or just void.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to move player using UI buttons, when using Input.mousePosition to shooting? (Android) 0 Answers

Unity Scaling for Android on 5.5. 0 Answers

Transform.localPosition Script Problem. 3 Answers

Bad piggies-like inventory? 0 Answers

Problem with "Saved by batching" 0 Answers


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