Cannot implicitly convert type 'UnityEngine.Object' to 'UnityEngine.GameObject'/ An explicit conversion exists (are you missing a cast?)

I’m going to apologize in advance for what is going to most likely be cringeworthy for most of you, as i know very little about unity and c#, and have just started a course at school.

Basically, i’m following a tutorial on YouTube : Unity Memory Game Tutorial - 2 - Laying Out Memory Buttons - Memory Game In Unity - YouTube (3:08 minutes in) and i have been given the error message as displayed in the title. It’s most likely due to the fact that i’m using an older version of unity (4.6) as this is the version which is used at the school i attend.

for(int i = 0; i < 8; i++) {
GameObject button = Instantiate(btn);
}

If someone could give me an alternative method to get this to work, i would be so grateful! (also, if you can try to use language for a unity newbie to understand :p) thanks!!

Unity’s Instantiate method returns an Object, not a GameObject. So, you’ll need to cast the result if you’re expecting a GameObject. Try this:

for(int i = 0; i < 8; i++) { GameObject button = Instantiate(btn) as GameObject; }

Note the additional as GameObject at the end.