I have script A, NOT attached to any GameObject:
public static class Trial {
var foo : int = 17;
function Update() {
foo++;
}
}
And script B, attached to a GameObject in the scene:
var bar : int;
function Update() {
Trial.Update();
bar = Trial.foo;
}
This works fine, and allows me to access the static class variable Trial.foo -- which increments every frame. However, why does Unity automatically run the Update() (among others) functions in scripts attached to GameObjects? Is there any way for me to have the above example WITHOUT script B needing the Trial.Update(); line?