How to give a unit detection
This mini-tutorial will show you how to give a unit detection of a cloaked unit.
First, open up the Data Editor. Select the unit you want to give detection. Over on the right, there should be several tabs. Click the one that says Behaviours. Then hit the green button to add a new behaviour. A box will appear; select from the dropdown list one of these three behaviours: Detection(10), Detection(11), or Detection(12). The numbers refer to how much detection range the unit will have.
If you wish to have other distances as the range, go to the Behaviours tab at the top right of the Data Editor. Search for Detector. Here you can either duplicate an existing Detector behaviour, or edit an existing one. In this case, we'll edit an existing one. Select Detection(10). On the right, click the Unit tab. Change the Modification - Detect number to whatever distance you'd like to have your unit detect to. In this case, we'll use 3.
To remove detection from a unit that already has it, select the unit in the Unit section of the Data Editor. Go to Behaviours, select the Detector behaviour, and click the red button on the right to remove it. The unit will no longer be able to detect.