Unity 官方网站:https://unity3d.com
点击右上角的 获取Unity
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
再不用就浪费了。555
Key.png
Arena of Valor
Ctrl+K+D
Tab.png
在 Camera 上面添加 C# 脚本。
VS.png
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
区别.NET Decompiler .NET反编译器 ILSpy
: https://github.com/icsharpcode/ILSpy
print
定义print.png
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
VS_print.png
dll
搜索 print
方法之后 Ctrl + 点击 Debug.log
ILSpy_print.png
// 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);
}
Debug.log
方法ILSpy_Debug.log.png
// 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 会发现 Print 方法的实现其实非常简单。
结论:
Debug.Log
的一个简单封装。实现就是通过Debug.Log来完成的。所以Print就是Debug.Log的一个简单封装。
Run.png
GitHub for Unity 是一款将 unity 发布到 GitHub 的扩展插件。
今天刚刚发布了 1.0 版本。
GitHub for Unity
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:
github.png
Windows
-> GitHub
-> Settings
and paste the url into the Remote
textbox. 在 Unity 中添加远程仓库。Save repository
. 保存。remote.png
History
tab and click Push
. 推送到 github.com 。GitHub for Unity链接: https://pan.baidu.com/s/1atsoakxUFDDbFcSlIme1qw 密码: ytsv
明天加载地图,控制英雄运动。
简宝玉写作群日更打卡第 32 天