unity 反射编辑器
2016-02-25 11:07
701 查看
using UnityEngine;
using System.Collections.Generic;
using UnityEditor;
using System;
using System.Linq;
public class ReflectionEditor : Editor
{
#region 继承链
[MenuItem("Reflection/向上的继承链")]
static void 向上的继承链()
{
for (int i = 0; i < Selection.objects.Length; i++)
{
var monoScript = Selection.objects[i] as MonoScript;
if (monoScript == null)
continue;
var type = monoScript.GetClass();
Debug.Log(type + " 向上的继承链 : ");
IEnumerable<Type> types = type.Assembly.GetTypes().Where(item => item.IsAssignableFrom(type) && item != type);
foreach (Type t in types)
Debug.Log(t);
}
}
[MenuItem("Reflection/向下的继承链")]
static void 向下的继承链()
{
for(int i = 0; i < Selection.objects.Length; i++)
{
var monoScript = Selection.objects[i] as MonoScript;
if (monoScript == null)
continue;
var type = monoScript.GetClass();
Debug.Log(type + " 向下的继承链 : ");
IEnumerable<Type> types = type.Assembly.GetTypes().Where(item => type.IsAssignableFrom(item) && item != type);
foreach (Type t in types)
Debug.Log(t);
}
}
#endregion
}
using System.Collections.Generic;
using UnityEditor;
using System;
using System.Linq;
public class ReflectionEditor : Editor
{
#region 继承链
[MenuItem("Reflection/向上的继承链")]
static void 向上的继承链()
{
for (int i = 0; i < Selection.objects.Length; i++)
{
var monoScript = Selection.objects[i] as MonoScript;
if (monoScript == null)
continue;
var type = monoScript.GetClass();
Debug.Log(type + " 向上的继承链 : ");
IEnumerable<Type> types = type.Assembly.GetTypes().Where(item => item.IsAssignableFrom(type) && item != type);
foreach (Type t in types)
Debug.Log(t);
}
}
[MenuItem("Reflection/向下的继承链")]
static void 向下的继承链()
{
for(int i = 0; i < Selection.objects.Length; i++)
{
var monoScript = Selection.objects[i] as MonoScript;
if (monoScript == null)
continue;
var type = monoScript.GetClass();
Debug.Log(type + " 向下的继承链 : ");
IEnumerable<Type> types = type.Assembly.GetTypes().Where(item => type.IsAssignableFrom(item) && item != type);
foreach (Type t in types)
Debug.Log(t);
}
}
#endregion
}
相关文章推荐
- 如何在Unity3D实现Admob
- 如何系统的学习 Unity 3D 中的 shader 编写nvidia cg 编程
- 关于unity安装简单说几句
- 如何添加AdMob广告到现有的Unity3D ios游戏
- Unity String转int[]存储,可进行Xor加密
- 如何将Unity集成到AdMob
- unity典型demo资源记录
- Connector of Dynamics CRM and AX: Leads, Opportunity, and Sales quotations
- 《Unity_API解析》 第二章(下) Camera类实例方法
- 怎样在Unity3D 中加入AdMob
- Admob Unity插件
- Admob Unity Package在Unity3.2上工作
- Unity3D-资源打包AssetBundle
- Unity3D-加载AssetBundle
- unity脚本执行顺序详解
- Unity的Shader开发教程整理
- Unity3d iOS 如何添加Admob
- 【Unity3D游戏开发】基于NGUI的表情图文混排解决方案 (二二)
- Unity3D Android游戏添加谷歌广告——使用AdMob
- unity DestroyBuffer can only be called from the main thread