i have unity 3.4 with license full!
i build it .apk it opend on my phone but doesnt function,
becz i neead a script for touch.
my script is whenever i click with the mouse the box disappears.
how can i change the mouse click to finger touch?
this is my script
function OnMouseDown(){
//if cube’s texture isn’t locked texture then it loads level number which we gave it in editor
// Something like this #if UNITY_IPHONE || UNITY_ANDROID
if (Input.touchCount == 1)
{
if (Input.GetTouch(0).phase == TouchPhase.Began)
{
var ray = Camera.main.ScreenPointToRay (Input.GetTouch(0).position);
var hit;
if (collider && collider.Raycast (ray, hit, 100.0))
{
OnMouseDown();
}
}
} #endif
where OnMouseDown is your normal OnMouseDown handler
Go look up tornado twins on youtube for good scripting lessons some are free and giva a basic understanding as long as you write the scripts not just look at them…
I only learned how to script a few months ago and i got to say its a lot easier than i thought it would be you just need to know how a computer speaks. Like learning chinese or summin.
Also look for a youtube page by willgoldstone. He gives in depth tutorials and most use scripts. Follow each one carfully then try to write the script out yourself thats how i learned
im pretty sure you have to use input.getTouch instead, or else multiple touch is disabled. cheack out the scripting reference and scroll down there should be a page on android scripts there