- Home /
Question by
AndreasX12 · May 06, 2014 at 10:04 AM ·
c#convertboo
Converting Boo to C#
I have never learned Boo, so it's really hard for me to convert Boo scripts to C#.
If there are anyone that would convert this little Boo-script to C# I would be really happy :)
import UnityEngine
class Vibrate(MonoBehaviour):
private viblator as AndroidJavaObject
def Start():
unityPlayer as AndroidJavaClass = AndroidJavaClass("com.unity3d.player.UnityPlayer")
currentActivity as AndroidJavaObject = unityPlayer.GetStatic[of AndroidJavaObject]("currentActivity")
viblator = currentActivity.Call[of AndroidJavaObject]("getSystemService","vibrator")
Vibator(20);
def _Dummy():
Handheld.Vibrate()
def Vibator(time as long):
viblator.Call("vibrate", time)
Thanks in advance.
Andreas.
Comment
It could be something like this. Note there is a line i have no clue about converting it.
using UnityEngine;
public class Vibrate : $$anonymous$$onoBehaviour {
private AndroidJavaObject viblator;
public void Start(){
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
/* No idea about this one -->*/ AndroidJavaObject currentActivity = unityPlayer.GetStatic[of AndroidJavaObject]("currentActivity")
viblator = currentActivity.Call("getSystemService","vibrator");
Vibator(20);
}
public void Dummy(){
Handheld.Vibrate();
}
public void Vibator(long time){
viblator.Call("vibrate", time);
}
}
I think that line should be
AndroidJavaObject currentActivity= unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
Your answer
![](https://koobas.hobune.stream/wayback/20220613144351im_/https://answers.unity.com/themes/thub/images/avi.jpg)