- Learning C# by Developing Games with Unity 5.x(Second Edition)
- Greg Lukosek
- 233字
- 2021-07-09 20:03:34
Understanding component properties in Unity's Inspector
GameObjects
have some components that make them behave in a certain way. For instance, select Main Camera and look at the Inspector panel. One of the components is the camera. Without that component, it will cease being a camera. It would still be a GameObject
in your scene, just no longer a functioning camera.
Variables become component properties
Any component of any GameObject
is just a script that defines a class, whether you wrote the script or the Unity's programmer did. We just aren't supposed to edit the scripts that Unity has written. This means that all the properties that we see in Inspector are just variables of some type. They simply store data that will be used by some method.
Unity changes script and variable names slightly
When we add our script to a GameObject
, the name of our script shows up in the Inspector panel as a Component
. Unity makes a couple of small changes. You might have noticed that when we added LearningScript
to Main Camera, Unity actually showed it in the Inspector panel as Learning Script. Unity added a space to separate the words of the name. Unity does this modification to variable names too. Notice that the number1
variable is shown as Number 1 and number2
as Number 2. Unity capitalizes the first letter as well. These changes improve readability in Inspector.
- Mastering Visual Studio 2017
- Flutter開發實戰詳解
- Web交互界面設計與制作(微課版)
- 云計算通俗講義(第3版)
- Responsive Web Design by Example
- C語言程序設計上機指導與習題解答(第2版)
- Lift Application Development Cookbook
- Delphi開發典型模塊大全(修訂版)
- 深入實踐DDD:以DSL驅動復雜軟件開發
- MyBatis 3源碼深度解析
- Learning Grunt
- Learning C++ by Creating Games with UE4
- 軟技能2:軟件開發者職業生涯指南
- 自己動手做智能產品:嵌入式JavaScript實現
- Neo4j High Performance