Reason: The eulerAngles is a property, and you cannot set only part of a property (transform.eulerAngles.x would invoke the getter method - which cannot be used as a setter). In other words: You need to use a temporary variable to do what you want to do :-)
Is it the same for the y angle? I just need to change the .x to .y?
The reason is that the property itself is private so not accessible from your class. They only created a getter to get the property but not a setter. They could probably create a setter for this, but whenever the code for setting this variable changes they have to change it at the base of the class as well and vice versa. Best practice is to have a single access point for setting properties otherwise things might get really messy, here they choose for having transform.eulerAngles as the access point for setting the euler angles x, y and z at once.
Is it the same for the y angle? I just need to change the .x to .y?
– MinorMapillai