以下の内容はhttps://baba-s.hatenablog.com/entry/2017/02/22/100000より取得しました。


【Unity】指定されたオブジェクトがプレハブの場合 true を返す拡張メソッド

using UnityEditor;

/// <summary>
/// UnityEngine.Object 型の拡張メソッドを管理するクラス
/// </summary>
public static class UnityEngineObjectExt
{
    /// <summary>
    /// 指定されたオブジェクトがプレハブの場合 true を返します
    /// </summary>
    public static bool IsPrefab( this UnityEngine.Object self )
    {
        var type = PrefabUtility.GetPrefabType( self );
        
        return 
            type == PrefabType.Prefab               || 
            type == PrefabType.ModelPrefab          || 
            type == PrefabType.PrefabInstance       || 
            type == PrefabType.ModelPrefabInstance  || 
            type == PrefabType.PrefabInstance
        ;
    }
}
if ( gameObject.IsPrefab() )
{
    ...
}



以上の内容はhttps://baba-s.hatenablog.com/entry/2017/02/22/100000より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14