From what I know, “this” points to the script attached to the paddle object. “gameObject” is the object that the script attached to. I don’t think “this” and “gameObject” are interchangeable, as “Destroy(this)” deletes the script and “Destroy(gameObject)” delete the object the script attaches to.
In 77. Movement By Mouse. There is a line of code:
- this.transform.position = paddlePos;
First I don’t understand this code. does “this.transform” indicate the x/y/z coordinates of the script? (a script can be moved around?)
Secondly, I modified the code into:
- gameObject.transform.position = paddlePos;
It also works the same as the previous line by changing “this” to “gameObject”. I am confused why they are interchangeable in this context.