Intro to 3D Game Development

0 of 193 lessons complete (0%)

Scripting Part 1: Moving Objects

Info: Local Variables

You don’t have access to this lesson
Please register or sign in to access the course content.

We used let to make a variable inside of a function (the tick function), and it’s surprisingly convenient and easy! However, that variable only exists inside that function, and if you try to reference it anywhere else, the program won’t know what you’re talking about.

Advantages of Local Variables

  • Don’t have to use the keyword this to access them.

Disadvantages of Local Variables

  • Can’t access them outside of their scope (e.g. in another function)
  • Don’t show up in the Entity panel