Siki_unity_4_unity 0 Basic Primer _c# Programming

Source: Internet
Author: User
Tags variable scope

4 Unity 0 Basics C # Programming Task 1: Course Materials Task 2: Introduction Task 3: Install Settings IDE Tools

Unity built-in Ide:monodevelop

Recommended Visual Studio

Download/install VS Community 2017 Community Edition is enough.

Edit->preference->external tools->external Script Editor

Task 4: Create the first C # code task 5: Save the scene and save the script

The file name of the script must be consistent with the class name of the script, because if a script is assigned to a gameobject,gameobject, it will be loaded according to the script's file name to the class that looks for the same name in the script.

Task 6: Single-line comments and multiline comments

vs Single-line comment shortcut: check code; ctrl+k Ctrl + C

Task 7: Log output

Print (); Limited, can only be used in components (inherit the Monobehaviour Class) (not yet in the case of non-components)

Debug.Log (); Unlimited, all can be used

Debug.logwarning (); Warning Log

Debug.logerror (); Error log

The log in the console window can be filtered to display the

Task 8/9: Declaring variables

Cannot start with a number

Note Variable scope

Task 10: Decimal and Integer data types

Integer:

SByte = system.sbyte--8-bit signed

Short = system.int16--16-bit signed

int = System.Int32--32-bit signed

Long = System.Int64--64-bit signed

byte = System.Byte--8-bit unsigned

ushort = system.uint16--16-bit unsigned

UINT = System.UInt32--32-bit unsigned

ULONG = System.UInt64--64-bit unsigned

Floating-point types:

Float:32 bit, pay attention to the F suffix when assigning value

Double:64 bit (15-bit precision)

Decimal

Task 11: Additional Data Types Task 12: arithmetic operator subtraction Task 13: Comparison operator Task 14:if statement task 15/16: Array declaration and use Task 17:for loop

Task 18:

Task 8:

Task 8:

Task 8:

Task 8:

Siki_unity_4_unity 0 Basic Primer _c# Programming

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.