this refers to the object described in the script. All Monobehaviour scripts are components, and the this keyword refers to the current component that's executing the code. It is a feature of C# and is defined by the C# runtime.
Inside a given function, this will always refer to the instance of the class that has been called. For example, if you had 100 Foo objects and called the bar() method on one of them, the the this would refer to that object.
gameObject is the game object in the scene. Game objects have components attached to them. From within a Monobehaviour script, you can access the game object that the script is attached to by using either this.gameObject or gameObject which are equivalent.
This is a general point about the this keyword. In most cases, variables do not have to be prefixed with this to be accessed, so that within class with a floatspam variable, the value could be accessed using either this.spam or just spam.
Hope this helps a little, or at least doesn't confuse you further!
Confused about the difference between this and gameObject in Unity 3D? Here's an extract from a support response from our online Unity course...
Search for past blogs and more.
+ Blogs by email.
+ Free mini course.
+ Early access offers.
Ben Tristem is an entrepreneur and online educator.