Variables between scripts

Hello, I’m having trouble effecting a variable from script A using script B.

My situation is that I have a coroutine using a variable, but I also want to have an update function so I can have the variable change every second. It threw up an error when I put an update function in the same script as a coroutine, so I moved it to a different script.
I tried making the variable in question a global variable, but it didn’t work as I had intended it. How else might I effect a variable in one function from another?
Any help would be greatly appreciated.

I had the same problem a couple of times. Try another var on script one that is static and outside your coroutine try to convert/= the static var that can be controlled by the update function on script B.

If you need to call the function every second you can just use Invoke. :smile: