[Unity] Chapter 1 Unity Script Development basics, Chapter 2 unity Script Development

Source: Internet
Author: User

[Unity] Chapter 1 Unity Script Development basics, Chapter 2 unity Script Development

Classification: Unity, C #, VS2015

Date created: 1. Introduction

The attraction of a game lies in its interactivity. If the game has no interaction, the scenario will be more beautiful and exquisite, and it is difficult to call it a game.

In Unity, game interaction is implemented through Script Programming. The script can be understood as the instruction code attached to the game object to define the behavior of the game object. Through scripts, developers can control the creation and destruction of each game object and the behavior of the object under various circumstances to achieve the expected interaction effect.

Script Development in Unity is very simple and efficient, because the Unity editor integrates many script editing functions, for example, the connection between scripts and Game objects, the modification of variable values, and the real-time preview of the game effect after the script is modified save a lot of time for adjustment and debugging during Script Development, this improves the efficiency of game development.

In addition, Unity has a built-in script resource package that provides a wide range of common scripts for game development to help developers quickly implement basic game functions. Ii. script languages supported by Unity

Unity supports three scripting languages: C #, JavaScript, and Boo.

Among them, JavaScript and C # are familiar to everyone, which is also the two most commonly used scripting languages in Unity. Boo is implemented by the Python language in. NET, with fewer users.

In the Unity project, scripts written in different languages can exist at the same time. For example, in the same project, some scripts may be written in C #, while others may be written in JavaScript, Which is okay. Therefore, developers can choose which language to use based on their preferences, without worrying about compatibility issues.

The Unity script language runs on Mono-based. NET platform. Therefore, various. NET libraries can be used, which provides a good solution for XML, database, and regular expressions. In addition, unlike traditional interpreted scripting languages, scripts in Unity are compiled, so they run quickly.

In general, in the same Unity project, the basic things can be written either in JavaScript or in C. However, in deep development (such as commercial game projects), C # is basically used for development. In addition, most third-party game plug-ins of Unity are also developed using C.

In addition, any functions written in JavaScript can also be implemented in C. Iii. Use MonoDevelop or VS2015


However, VS2015's editor and debugger are much better than MonoDevelop (for example, setting breakpoints), and you do not have to switch back and forth between VS2015 and Unity when creating or modifying multiple scripts, you can directly create and edit multiple script files in VS2015. After all the modifications to the script are completed and saved (Note: You must save them), and then switch to Unity to directly use these scripts. In addition, the synchronization between Unity and VS2015 is completed automatically, and you do not need to exercise this mind. You only need to edit and save it in VS2015.

Therefore, when developing games with Unity, the preferred scripting language is C #, and the preferred Script Editor is VS2015.

However, if you are not familiar with C # (for example, Java developers), you can also use JavaScript to compile it. This is why JavaScript is used to write scripts when developing mobile games with Unity in Java, because they do not use C #, so they have to leave the second place. Iv. Examples in this Chapter

All examples in this chapter are in the ch06Demos project.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.