Clicking a button

Hello,

I have a 3D-text, and a C# script, and i want to make the game closed, when clicked on this text… Does anybody know how to do that ?

If you put a collider on that object, you can just do the classic mouse-click to raycast to action maneuver.

classic mouse-click to raycast to action maneuver. ?

Sorry, ^^ but i’m new in unity… and not as that good in C#

  • and i’ve got a collider ^^

The example on the bottom should get you started. You can use the hit in that example to get information about the object.

This is a good time to learn how to cast rays from mouse clicks and the like, because you’re going to need a lot of that for interaction with things other than GUIs.

What exactly do i get with a ray ?

I’ve got an other way to get it done.

void OnMouseDown ()
{
}

The only thing i need now is the order to quit the game…

and the rest comes after that ^^

Things like options menu and stuff

it’s Application.Quit();

it’s working :slight_smile: niiice

@MarkusDavey: Thanks… got it already… but thaank you ;D