Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //****** Donations are greatly appreciated. ******
- //****** You can donate directly to Jesse through paypal at https://www.paypal.me/JEtzler ******
- void Update () {
- if(Input.GetMouseButtonDown(0)) {
- SelectTarget();
- }
- }
- void SelectTarget () {
- Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
- RaycastHit hit;
- if(Physics.Raycast(ray, out hit, 10000)) {
- if(hit.transform.tag == "enemy") {
- selectedUnit = hit.transform.gameObject;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement