Hi all :)
Maybe this is old news but I had an epic battle with this method this evening :) and maybe this could be helpful to newbies.
Was doing the C# survival course with a lesson on collectible gameobjects and it used this method of course. No matter what I did, I couldn't get it to work ( used Unity 2018.2 with VS 2019 ). After a long Google session I found this :
So I switched to VS 2017 and all problems solved !!! :)))
Happy Coding
Crispi