is it a good idea to mark a variable as static if multiple scripts need a reference to it? does this help with memory?
Making a variable static has a couple advantages. For one, it is now bound to the type itself, instead of an instance. This means that you can access it by writing SomeType.someStaticVariable, instead of first creating an instance of SomeType first. This, of course, is helpful if you want to store some ‘global variables’ for easy accessability throughout multiple scripts. In this case it’s not gonna do a lot for memory usage, but it can. One example for this would be if you had a Character class which has an private int currentHealth, and a private int maxHealth field. The latter cannot change and is the same for all instances, so you could make it static (since / if all characters have the same maxHealth). If you now create a couple thousand instances of Character, you save a bit of memory that way, since a static variable only takes up one place in memory, while instance bound variables exist once per instance (since they would change independantly, like the currentHealth for example).
Most of the time static variables are also constant (which makes sense for maxHealth), but it’s also possible to make them settable (for example if maxHealth can increase, even tho i would probably handle that differently).
When exactly you use it is up to you. You dont really ever have to use it, but it offers some nice conveniences and sometimes other advantages, one of which is the aforementioned memory usage.