Unity 安裝
Unity 官方網(wǎng)站:https://unity3d.com
點擊右上角的 獲取Unity
系統(tǒng)要求
OS: Windows 7 SP1+, 8, 10, 64-bit versions only; Mac OS X 10.9+.
GPU:有DX9(著色器模型2.0)功能的顯卡。2004年以來的產品應該都可以。
版本
Unity 2018.1.1f1: https://unity3d.com/cn/unity/whatsnew/unity-2018.1.1
默認安裝即可。
登錄 Unity 賬戶,我有一個 Unity 線下活動中的一年 Unity Plus with Unity Teams Advanced
- ¥2,880.00/year
再不用就浪費了。555

《王者榮耀》 App Store 英文名稱是 《Arena of Valor》

Visual Studio 設置
- 代碼格式化(自動對齊):(三個鍵同時按下)
Windows
Ctrl+K+D
macOS
^ + I
- Tab(制表符) 轉 4 個 Space (空格)

在 Camera 上面添加 C# 腳本。
Hello World
https://zh.m.wikipedia.org/zh-sg/Hello_World
Hello, World是指在電腦屏幕顯示“Hello, World!”(你好,世界?。┳址挠嬎銠C程序。相關的程序通常都是每種電腦編程語言最基本、最簡單的程序,也會用作示范一個編程語言如何運作[1]。同時它亦可以用來確認一個編程語言的編譯器、程序開發(fā)環(huán)境及運行環(huán)境是否已經(jīng)安裝妥當。因為寫法簡單可見,這也是很多初學者首次接觸編程語言時會撰寫的程序。
傳統(tǒng)用途
傳統(tǒng)來說,當一位程序員接觸一門新的編程語言的時候,“Hello, World”就會成為首個接觸的內容。
與此同時,相同的字符串亦會用作檢測開發(fā)環(huán)境是否安裝妥當以及相關的操作人員是否理解相關的環(huán)境。
歷史
于1972年,Bear實驗室成員布萊恩·柯林漢撰寫的內部技術文件《A Tutorial Introduction to the Language B》首次提到了Hello World這字符串。當時,他使用B語言撰寫了第一個使用參數(shù)的Hello World相關程序:
main(){
extrn a,b,c;
putchar(a); putchar(b); putchar(c); putchar('!*n');
}
a 'hell';
b 'o, w';
c 'orld';
由 布萊恩·柯林漢 撰寫的“Hello, world”程序 (1978年)
這個程序成為了第一個Hello World的示范程序。之所以會這樣切割,是因為于B語言中,每個參數(shù)只能放置四個ASCII字符[5]。兩年后,布萊恩·柯林漢和丹尼斯·里奇基于B語言寫成C語言后,在他們撰寫的《C程序設計語言》使用更簡單的方式展示Hello World:
#include <stdio.h>
main( )
{
printf("hello, world\n");
}
自此,Hello World成為了電腦程序員學習新的編程語言的傳統(tǒng)[6]。但是,有些人認為 hello, world 的字符串早于1966年的BCPL語言出現(xiàn)的時候已經(jīng)出現(xiàn)[7]。雖然相關的字詞確實在發(fā)明者記錄的文件出現(xiàn),但是可以肯定的是,Hello World這字符串于當時確實未變得流行。因此,人們公認為布萊恩·柯林漢是令相關字符串走進公眾目光的人。
但是需要注意的是,Hello World的初始寫法為“hello, world”,并沒有任何感嘆號,全部都是小寫,內含逗號,后面亦有空格,而和現(xiàn)在流行的寫法并不一致。
Unity 中的 Hello World

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HelloWorld : MonoBehaviour
{
// Use this for initialization
void Start()
{
print("Hello, World!");
}
// Update is called once per frame
void Update()
{
Debug.Log("hello, world");
}
}
print vs Debug.Log 區(qū)別
.NET Decompiler .NET反編譯器 ILSpy: https://github.com/icsharpcode/ILSpy
- vs 中查看
print定義

- 找到
dll路徑
#region 程序集 UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// C:\Program Files\Unity\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
#endregion

- ILSpy 打開
dll搜索print方法之后 Ctrl + 點擊Debug.log

// UnityEngine.MonoBehaviour
/// <summary>
/// <para>Logs message to the Unity Console (identical to Debug.Log).</para>
/// </summary>
/// <param name="message"></param>
public static void print(object message)
{
Debug.Log(message);
}
- ILSpy 查看
Debug.log方法

// UnityEngine.Debug
/// <summary>
/// <para>Logs message to the Unity Console.</para>
/// </summary>
/// <param name="message">String or object to be converted to string representation for display.</param>
/// <param name="context">Object to which the message applies.</param>
public static void Log(object message)
{
unityLogger.Log(LogType.Log, message);
}
在學習或使用 Unity 的時候,就會遇到調試的問題,在 Unity 3d 中調試比較麻煩,不像在vs中可以直接設置斷點來調,所以選擇打印消息的方式來調試。
但是打印消息也有幾種方式,一種的 Print,一種的 Debug.Log 等。
Print 是 MonoBehaviour 的一個成員。
Debug 則是一個密閉的類。
所以在使用的范圍上,Print 必須要繼承 MonoBehaviour 類,而 Debug 不用。
在 ILSpy 中反編譯 UnityEngine.CoreModule.dll 這個 DLL 會發(fā)現(xiàn) Print 方法的實現(xiàn)其實非常簡單。
結論:
Debug.Log的一個簡單封裝。實現(xiàn)就是通過Debug.Log來完成的。
運行

GitHub for Unity: https://unity.github.com/
GitHub for Unity 是一款將 unity 發(fā)布到 GitHub 的擴展插件。
今天剛剛發(fā)布了 1.0 版本。

If the current Unity project is not in a Git repository, the GitHub for Unity extension will offer to initialize the repository for you. This will:
- Initialize a git repository at the Unity project root via git init 初始化 git
- Initialize git-lfs via git lfs install 安裝 git-lfs 和 git lfs
- Set up a .gitignore file at the Unity project root. 添加 .gitignore 到 Unity 項目根目錄
- Set up a .gitattributes file at the Unity project root with a large list of known binary filetypes (images, audio, etc) that should be tracked by LFS 添加 .gitattributes 文件過濾 大文件
- Configure the project to serialize meta files as text 設置 meta
- Create an initial commit with the .gitignore and .gitattributes file. 初始化提交包括 .gitignore and .gitattributes 在內的文件
Publish a new repository
- Go to github.com and create a new empty repository - do not add a license, readme or other files during the creation process. 去 github.com 創(chuàng)建一個空的倉庫。

- Copy the https URL shown in the creation page 拷貝 https URL。
- In Unity, go to
Windows->GitHub->Settingsand paste the url into theRemotetextbox. 在 Unity 中添加遠程倉庫。 - Click
Save repository. 保存。

- Go to the
Historytab and clickPush. 推送到 github.com 。
issus: Push 按鈕是灰色的,不能點擊
用命令行工具上傳
$ git push -u origin master
GitHub for Unity 鏈接: https://pan.baidu.com/s/1atsoakxUFDDbFcSlIme1qw 密碼: ytsv
明天加載地圖,控制英雄運動。
簡寶玉寫作群日更打卡第 32 天