コガネブログ

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

【Unity】【Odin - Inspector and Serializer】Project ビューのプレハブの値を非表示にする「HideInPrefabAssets」属性

目次

「HideInPrefabAssets」属性

「HideInPrefabAssets」属性を使用すると
Project ビューのプレハブの値を非表示にすることができます

Project ビューのプレハブ

f:id:baba_s:20170803103437p:plain

Hierarchy ビューのプレハブ

f:id:baba_s:20170803103443p:plain

プレハブではないオブジェクト

f:id:baba_s:20170803103443p:plain

ソースコード

using Sirenix.OdinInspector;
using UnityEngine;

public class Example : MonoBehaviour
{
    [HideInPrefabAssets] public int a;
}

使い方

下記のように記述するだけで使用できます

[HideInPrefabAssets] public int a;