- Mastering Unity 2D Game Development(Second Edition)
- Ashley Godbold Simon Jackson
- 449字
- 2021-07-08 11:05:17
Changes to Unity 5
If you have been working with Unity 4.x and are now starting out in Unity 5.x, there are a few key differences in the way things behave. Here you will find a general overview of the most relevant changes to 2D game development, other than the ones already discussed concerning 2D physics.
Note
The following list does not include all of the new features included in Unity 5 and the Unity 5.3 update. For a complete list, visit http://unity3d.com/unity/whats-new/unity-5.0 and http://blogs.unity3d.com/2015/12/08/unity-5-3-all-new-features-and-more-platforms/.
Licensing
Let's start with the best new feature of Unity 5. In previous versions of Unity, certain features were only available in the Pro version and were blocked in the free version. However, in Unity 5, all features are unlocked and can be enjoyed even by developers using the free version, now named Unity Personal. If a game you create with Unity Personal makes $100k or more, you will have to pay for the professional version.
Component access
Another big change to Unity 5 is the removal of quick property accessors within code. This means that a lot of your code written for Unity 4 will need to be rewritten. For example, the use of .rigidBody2D
and .collider2D
are no longer permissible. However, if you have code in your game from an older version of Unity, you will be shown the following warning:

Selecting I Made a Backup. Go Ahead! will automatically convert all quick property accessors to code containing the GetComponent
function. For example, take the following code that was previously written as:
object.ridgidBody2D.isKinematic=false;
Now the preceding code would now be written as follows:
object.GetComponent<Rigidbody2D>().isKinematic=false;
Note
Make sure you back up your code before selecting, I Made a Backup. Go Ahead! The automatic changes may not be what you expect.
Animator changes
The most glaring difference when you initially start up the Unity 5 Animator will be the inclusion of an Entry node. Unity 5 has now added Entry and Exist nodes to StateMachines (we will discuss state machines in Chapter 8, Encountering Enemies and Running Away). These nodes allow the transition between states machines. For the most part, you animations that were running in Unity 4 should run appropriately in Unity 5, but will include the new Entry node, as shown in the following screenshot:

StateMachine Transitions with Entry and Exit nodes provided by Unity
Audio mixing
Previously, if you had a lot of audio sources in your game, dealing with all of them could be quite a hassle. Unity 5 provide an Audio Mixer asset type that now allows you to adjust all of your audio levels more efficiently, as show in the following screenshot:

Audio Mixer image provided by Unity
- 少兒人工智能趣味入門:Scratch 3.0動畫與游戲編程
- 基于粒計算模型的圖像處理
- INSTANT Mercurial SCM Essentials How-to
- Learning ELK Stack
- Mastering Android Game Development
- Java程序設計案例教程
- Java Web應用開發給力起飛
- HTML5移動前端開發基礎與實戰(微課版)
- 大規模語言模型開發基礎與實踐
- Java EE項目應用開發
- Kotlin語言實例精解
- Appcelerator Titanium Smartphone App Development Cookbook
- Real-time Web Application Development using Vert.x 2.0
- 軟件定義存儲:原理、實踐與生態
- Visual C++實用教程