im making a 2d rts and I need this to select units…
script is posted
p.s. how should i make deselection happen?
5171873–513248–Select_Mang.cs (887 Bytes)
im making a 2d rts and I need this to select units…
script is posted
p.s. how should i make deselection happen?
5171873–513248–Select_Mang.cs (887 Bytes)
You would use gameObject.GetComponent().
So let’s just do a quick example:
You want to detect the player’s script when he is detected and disable it.The name of that script you want is WeaponScript
public GameObject playerGo;
// When your raycast returns true
playerGo.GetComponent<WeaponScript>().enabled = false;
I would say that it would be a good idea to Start() with the script enabled or at least set it up to be re-enabled somewhere.