x


Select something using mouseclick

Hello everyone,

I'm quite new with Unity and am starting to build a tower defense.

I've set up a few things but now I wonder how I might select something.

I need, during the game, to be able to select something and make it do something (ex: select a tower and make it aim at a certain place). But i've yet to figure out what to do and how to do it. I fugure I'd need to use MonoBehaviour (already using this), but that's as far as I got.

Anyone can give me any info on that? Thanks!

more ▼

asked Feb 26 '12 at 10:52 PM

Herve_Simard gravatar image

Herve_Simard
46 8 13 15

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

The OnMouseDown event call of the MonoBehaviour class is your friend ;)

Simply attach a collider and a script to your tower object and implement the OnMouseDown function.

more ▼

answered Feb 27 '12 at 02:18 AM

Tommynator gravatar image

Tommynator
381 3 4 11

Thanks, I've just read a few things following your suggestion. Problem is, now, that I can't fathom how to use it. Any ideas?

Feb 27 '12 at 03:28 PM Herve_Simard
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3337
x130
x13

asked: Feb 26 '12 at 10:52 PM

Seen: 682 times

Last Updated: Feb 27 '12 at 03:28 PM