- Home /
How to Vibrate only 3 seconds when player collided with obstacle??
when my player collided with obstacle then vibrate successfully but I want only 3 seconds to vibrate when player collided with obstacle ??
obstacle.cs
void OnTriggerEnter2D(Collider2D other) //player collided with obstacles
{
if (child.tag == "obstacleobject" || child.tag == "obstacleobjectone")
{
Handheld.Vibrate();
}
}
I have multiple obstacles so I want when player collided with obstacles then vibrate(3 seconds)??
Answer by Grish_tad · Sep 02, 2019 at 03:10 PM
You need to use a plug-in for it. By default Unity's Handheld.Vibrate() duration is 1 second. Here are some solutions
Here you can find code for android https://www.reddit.com/r/Unity3D/comments/4j5js7/unity_vibrate_android_device_for_custom_duration/ I can send you $$anonymous$$e, if you give me your email address.
Your answer
Follow this Question
Related Questions
how to change transform.Translate speed 0 Answers
Unity4.6 OnTriggerEnter2D is not called constantly 1 Answer
Detector NPC on trigger zone. 0 Answers
New input system and Scene Manager 0 Answers