- Home /
I need to move a sprite when an UI button is clicked
So i have a sprite that fills only half of the screen in the main menu and i want it to move to the middle so it fills the whole screen when you click the settings button, i tried to write a code for that using lerp and onclick() but the public void for that didnt show up in the editor. Is there an easier way to do this? Maybe move it in other way or something...
Comment
Answer by Infenix · Jan 20, 2021 at 02:23 PM
This i a right way to do it. I think what you did was to drag directly the script in the reference field. What you actually have to do is to attach this script to an empty game object, then reference this game object. After doing this, you should be able to select the function in script name -> function name.