# RTS basic selection issues

**URL:** <https://discussions.unity.com/t/rts-basic-selection-issues/697768>\
**Category:** Physics\
**Tags:** Scripting\
**Created:** [April 10, 2018, 12:07pm UTC](https://discussions.unity.com/t/rts-basic-selection-issues/697768 "2018-04-10T12:07:10Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![methos5k](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/methos5k/32/387158_2.png) [@methos5k](https://discussions.unity.com/u/methos5k)\
**Post date:** [April 10, 2018, 12:34pm UTC](https://discussions.unity.com/t/rts-basic-selection-issues/697768/2 "2018-04-10T12:34:23Z")

</div>

Please use code tags when posting code on the forums. You can look at this thread for how to do that: [Using code tags properly](https://discussions.unity.com/t/481379)

I think the simplest solution would be to use the IPointerDown (/Click) handler interface. That would intercept the event for the unique game object. In the method, you can set the projector active/not.

However, for some additional info, to answer the question about “choosing the raycast hit game object”, what you could keep in mind is that you could use GetComponent to get a script on the ‘hit’ game object. Using that variable, you could call a method on the script to do your activate/de-activate.

One other thing that came to mind, was that since your raycasting also depended on the MouseButtonDown, you could have moved the raycasting portion of code within a block to execute, only if GetMouseButtonDown(0) was true, thus eliminating unnecessary calls.

Also, you could use this code in place of what you have:

```auto
projector.SetActive(!projector.activeSelf);

```

However, if your code is easier to understand, just keep it… except that you should use ‘false’ instead of ‘!true’, as it’s a bit more straightforward. 🙂

I hope that helps…

---

_[View the full topic](https://discussions.unity.com/t/rts-basic-selection-issues/697768)._
