コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

【Unity】ログ出力を Scene ビューに表示できる「Scene view notification」紹介

はじめに

「Scene view notification」を Unity プロジェクトに導入することで
ログ出力を Scene ビューに表示できます

使用例

f:id:baba_s:20200718190328g:plain

使い方

using System.Collections;
using UnityEngine;

public class Example : MonoBehaviour
{
    private IEnumerator Start()
    {
        while ( true )
        {
            SceneViewNotification.Add( "ピカチュウ", SceneViewNotification.NotificationType.Info );

            yield return new WaitForSeconds( 0.5f );

            SceneViewNotification.Add( "カイリュー", SceneViewNotification.NotificationType.Warning );

            yield return new WaitForSeconds( 0.5f );

            SceneViewNotification.Add( "ヤドラン", SceneViewNotification.NotificationType.Error );

            yield return new WaitForSeconds( 0.5f );
        }
    }
}

SceneViewNotification.Add を使用します