Script for changing scene

Hello everybody !

I have a problem, i’m new to Andriod scripts and I would like to know what is the same thing on Android for the OnMouseEnter() because for exemple I have a cube and when I click on it, I would like to go to another scene.

Thank you :slight_smile:

Read everything about the touch functionality HERE. It will help you understand how it works…

use : Application.LoadLevel(“scene name”); in build setting add that scene

Thank you for the link but I already went to that page and more exactly to the Input section. There I couldn’t find the right expression that looks like OnMouseDown()

Thank you but I do know that. What i’m looking for example

I want to know the equivalent of OnMouseEnter on Android

This is very rough example of how you can do that:

void Update() {     
    if (Input.touchCount == 1){         
        // Do something     
    } 
}

Then you use cube’s position and convert it to screen coords (WorldToScreenPoint)
Then compare those coords with your touch coords and see if the touch occured on the cube.

I really don’t feel like writing you a whole code when you can do that yourself if you just search this forum, google, unity docs and look at all examples here.

Because of your exact issue, i swapped out the unity Monobehaviour messages for my own input dispatcher. This isn’t really well tested, but you should get the idea by looking at this file:
https://github.com/Znoey/Pheonix_Game/blob/master/Scripts/InputMessageDispatch.cs