Instantiate is a method (another name for function) on Unity's Object class, but it's a static method, so it is actually available from everywhere. You don't have to inherit from Object to be able to use it. However, if your class doesn't inherit from Object, you need to specify the path to the function in full like this:
I believe it is the new version of Unity, because all of my scripts containing classes give me errors when I Instantiate or transform.(position, rotation, etc) anything involving variables from those classes. My entire test game is now a mess.
I was able to fix the Instantiate problem by adding GameObject. in-front of Instantiate…
cannon is a class name
cannonball is a variable declared in this class
spawnPos is a variable declared in this class
instanceCannonball is a variable declared as a GameObject outside of this class, like: var instanceCannonball : GameObject;