Yeah, that's because selectedTarget is typecast as a Transform, while my code specifies it as a GameObject. My bad. :D Change this line:
selectedTarget = hit.collider.gameObject;
to:
selectedTarget = hit.collider.gameObject.transform;
That should work.
Hope that helped, Klep
↧