GetComponent().sprite <<< Don't exist. (Is this a bug)? 5.4.0f3

Hey guys, this is a first I’ve ever seen this issue before.

GetComponenet().sprite just doesn’t exist.
Yes I am using ‘using UnityEngine.UI;’

but sprite just plainly doesn’t exist.
It’s giving me the options in the image below (the things above the little menu are just GetType and stuff.)
And yes I’ve tried texture with a ‘as Sprite’, ‘as Texture’, ‘as Texture2D’, etc.

Not sure if this is a bug with the newest Unity.


I got it working. Well, kind of. It’s still a bug I am definitely going to file with Unity.

Just had to import my stuff to a new project and now it works.
It doesn’t make any sense.

I copy paste entire script into new script (still broken), but if I copy and paste that small section of code including anything in realtion to it, it works.

But ultimately, it’s something to do with the project its self. Tried restarting Unity + Mono at least 10 times. Tried Close Solution like @flashframe mentioned. Still to no avail.

Going to submit this as a bug report and go onto to the new project.
Technically, everyone that has posted is correct on how to fix the issue, because I’ve had the same experiences about closing and re-opening, etc. But this time it’s different and something tells me it has something to do with a Unity bug somewhere.

Because as mentioned, moving to a new project - fixed.