- Learning C# by Developing Games with Unity 5.x(Second Edition)
- Greg Lukosek
- 140字
- 2021-07-09 20:03:35
Where you declare a variable is important
You will be declaring and using variables in many places in a script. The variables that I have shown you so far are called member variables. They are members of the LearningScript
class—not declared within any method. These member variables are the only variables that have the option of being displayed in the Inspector panel or being accessed by other scripts.
Note
Declaring your member variables at the beginning of a class may give you a mental clue that these member variables can be used anywhere in the script.
We will also be creating variables in methods. These variables are called local variables. They are never displayed in the Unity's Inspector panel, nor can they be accessed by other scripts. This brings us to another concept of programming, called variable scope.
- .NET之美:.NET關(guān)鍵技術(shù)深入解析
- Web開發(fā)的貴族:ASP.NET 3.5+SQL Server 2008
- 基于免疫進(jìn)化的算法及應(yīng)用研究
- OpenNI Cookbook
- Java設(shè)計模式及實踐
- Apex Design Patterns
- C#實踐教程(第2版)
- JavaCAPS基礎(chǔ)、應(yīng)用與案例
- Julia高性能科學(xué)計算(第2版)
- 常用工具軟件立體化教程(微課版)
- jQuery炫酷應(yīng)用實例集錦
- Vue.js 2 Web Development Projects
- 深入淺出Go語言編程
- Web性能實戰(zhàn)
- RocketMQ實戰(zhàn)與原理解析