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