I’m sure there’s something absolutely obvious I’m missing here but I just can’t see it.
I have 2 scripts containing just integers, Stats and Storage. Both are attached to Prefabs. On my player object I have an OnTriggerEnter(Collider Col)…however when I attempt to use Col.gameObject.GetComponent<>() to get info from the Storage script, the option just isn’t there. However, I can access Stats.
I’ve compared the scripts and the only difference I can see is that one one, the word ‘monobehaviour’ just after the "public class Storage : " declaration at the top is blue on one of them, and black on the other.
What is going on? Obviously it’s simple as I’ve done it once already, but I can’t for the life of me spot what I haven’t done…
Well Something happened. Shutdown and loaded Unity a couple of times - don’t think I played with the script at all…then suddenly the text colour changed and it worked…
If that’s what happened (and I was wondering if that was the issue)… it was most likely just an issue with loading properly (sorry, I don’t know the exact terminology) - but that happens to me, too.
Not fun, but 99% of the time, if I close my IDE and re-open the file, from within Unity, it’s working/fixed.