- Home /
how to dynamically change 2d sprite offset when drawing?
I have a couple of 2d sprites, and I want the image to slightly move up when the mouse goes over them, to indicate they can be picked up. How can I do this without changing the actual gameObject's transform.position?
What I want to do is to draw the 2d sprites a couple pixels above without changing the game object position, when the mouse goes over the sprite. Any ideas? Thanks in advance!
Answer by toficofi · Mar 22, 2021 at 08:29 PM
You could put the sprite in a containing GameObject and then set the transform.localPosition
of the inner sprite. Or, you could use the animator.
Your answer
Follow this Question
Related Questions
Layer Sprites Based on Y axis 1 Answer
Sprite Failing to Load into Scene 0 Answers
Anyone knows how to refresh tiles? 0 Answers
2D Sprite image not showing up in scene or game view 1 Answer
Unity2D strange green line under sprites 0 Answers