Categories: Unity, C #, VS2015
Date Created: 2016-04-16 I. INTRODUCTION
The attraction of the game lies in its interactivity. If the game does not interact, the scene is more beautiful and refined, it is difficult to call it a game.
In unity, game interactions are implemented through scripting. A script can be interpreted as an instruction code attached to a game object to define the behavior of the game object. Through scripting, developers can control the creation, destruction, and behavior of objects in various situations to achieve the desired interaction.
Scripting in unity is easy and efficient because the Unity editor integrates many of the features of scripting, such as the connection of scripts to game objects, the modification of variable values, and the real-time preview of script-modified game effects, which saves a lot of time during script development and tuning and debugging. Improve the efficiency of game development.
In addition, unity has built-in a script resource bundle that provides a wealth of common scripting in game development to help developers quickly implement the basic functions of the game. Second, unity-supported scripting languages
Unity supports 3 scripting languages: C #, JavaScript, and Boo.
JavaScript and C # are all familiar, and this is the two most common scripting languages in unity. Boo is an implementation of the Python language on. NET, with relatively few users.
In Unity Engineering, you can have scripts written in different languages at the same time. For example, in the same project, some scripts might have been written in C #, while others might have been written in JavaScript, and that's fine. As a result, developers can choose which language to use to develop them according to their preferences without worrying about compatibility issues.
Unity's scripting language runs on the mono-based. NET platform, so you can use a variety of. NET libraries, which also provide a good solution for issues such as XML, databases, regular expressions, and so on. In addition, unlike the traditional interpreted scripting language, the scripts in unity are compiled, so they run fast.
In general, in the same Unity project, the basic things can be written either in JavaScript or in C #. However, in-depth development (such as the actual Business game project) is basically developed in C #. In addition, the vast majority of Unity's third-party game plug-ins are also developed in C #.
Also, any functionality written in JavaScript can be implemented in C #. Third, the use of MonoDevelop or VS2015
All can.
However, VS2015 's editor and debugger are much stronger than monodevelop (such as setting breakpoints, etc.), and when creating and modifying multiple scripts, you do not have to switch back and forth between VS2015 and unity, creating and editing multiple script files directly in VS2015. After all the script changes are complete and saved (Note: You must save), and then switch to unity, you can use these scripts directly. In addition, the synchronization between unity and VS2015 is done automatically and does not require you to go to the heart, you just need to edit and save in VS2015.
So, when developing a game with unity, the preferred scripting language is C #, and the preferred Script Editor is VS2015.
However, if you are unfamiliar with C # (Java developers, for example), you can also choose to write with JavaScript. That's why Java's use of unity to develop mobile games is scripted with JavaScript because they don't have C # and have to go back to the next. Iv. examples of this chapter
All the examples in this chapter are in the Ch06demos project.
"Unity" chapter 6th Unity Script Development Basics