First it was moving outside the bounds of the bar so what I've tweaked is the WaitForSeconds timing by making it much smaller. By doing that, the system checks where the cursor is at much more often. With that, I have made the Vector3 y-coordinate speed much smaller since the delay happens much less. When it was time to change the direction of my bar (from going up to going down and vice versa), I just added a - (negative sign) to moveWhere so that it goes opposite. The code works like perfectly well!

You may have created a public variable through script, but then you can't change it. Why is that? It's because you can only change it through the interface, in Unity. Otherwise make the variable public. That's just how it works.

About

About: This is a blog about game design and development by me. I am an amateur game designer/developer and I want to write here as I go on the journey of learning about game development and game design. I do this because I want to share with the world what I've learned and keep a record of my progress as well as know notes.

Right now I am concentrating on RPG games. I am thinking in going after board games later.