Does the script in a game object control the object or the sprite in the object? (SOLVED)

Does the script in a game object control the object or the sprite in the object?
I’m asking because I want to change the position of a sprite in a script and unsure whether to use the position of the object or sprite.

You cannot manually set the position of the sprite at runtime ( @sven is there a technical reason why not? ). You can put the sprite onto a child game object which is parented to the game object with the script and then use the script to position the sprite’s game object relative to its parent.

So, by default, the script controls only the game object and links to the sprite?

The script has relative knowledge of which GO it is a component of. So when you write “.” or “#sprite” it will be relative to that GO. The sprite inherits transforms from its parent GO. Otherwise you can tell a sprite to change its shader material values / enable or disable it / flip it and that’s about it.

Ok, thanks!

For reference: the full list of things you can do to a sprite can be found here, in the API Documentation.