I’m trying to make a lock sprite appear when something is locked and disappear when it is unlocked.
Easiest way is a public variable in the script that you enable.
If using the 4.6 UI just do this.
public Image lockImg;
You also need this;
using UnityEngine.UI;
At the top of the script to use UI elements in the script. Then when you want it enabling…
lockImg.enabled = true;
and false to disable it. Once the script is saved simply drag the Image onto the slot in the inspector.