Unity中几行代码画一颗圣诞树(Debug.log永远的神)

相信大佬们在捣鼓自己的project的时候总是少不了会打开Console窗口查看输出的日志和错误,在冬天和圣诞节快来的时候给自己画一颗圣诞树,是不是显的十分有意思呢,不需要shader不需要materials也不需要复杂的模型,仅仅需要输出几行日志,就可以给这个冬天带来一丝暖意,何乐而不为呢?

效果:

 

 代码:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ChristmasTree : MonoBehaviour
{
    void Awake()
    {
        Debug.Log("这是一颗圣诞树");
        Debug.Log(string.Format("         <color=yellow>*</color>"));
        Debug.Log(string.Format("       <color=green>*</color><color=white>*</color><color=green>*</color>"));
        Debug.Log(string.Format("     <color=green>*</color><color=white>*</color><color=white>*</color><color=white>*</color><color=red>*</color>"));
        Debug.Log(string.Format("   <color=green>*</color><color=white>*</color><color=green>*</color><color=white>*</color><color=white>*</color><color=white>*</color><color=green>*</color>"));
        Debug.Log(string.Format("  <color=red>*</color><color=white>*</color><color=white>*</color><color=white>*</color><color=green>*</color><color=green>*</color><color=green>*</color><color=white>*</color><color=green>*</color>"));
        Debug.Log(string.Format("         <color=#7E4123>||</color>   "));
    } 
}

温馨提示:记得把脚本拖到创建的物体上才会输出日志......

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>