I (think I) know what I am letting the program trying to do (calling a script to move one node whilst it are multiple nodes), But I want to move all the ground nodes.
CuteAlien wrote:Variables have to be declared inside the scope (usually between the {} braces) to be used.
What variables?
When I comment out the second code everything works, I created a bunch of nodes with the same name, Are you sure its not a mishap there?
CuteAlien wrote:Variables have to be declared inside the scope (usually between the {} braces) to be used.
What variables?
All variables. You can't use one that isn't declared in the scope in which you try to use it. You can use everything from everywhere when it is in the global scope (declared outside your classes functions) - which is not recommended! All local variables are only valid within their local scope. Which is usually defined by the {} braces. Membervariables can be accessed by their class-object (if that is declared in a local scope).
// declared outside functions. Will be global.
int global = 1;
// some function, param is valid only within Foo
void Foo(int param)
{
int local=2; // valid within the function (same as param)
{
int small_scope =3; // only valid until next }
}
// int y = small_scope; // this would get you an error because small_scope no longer valid here
}