通过名称挂载脚本
提供专属的一对一在线答疑,快速答疑解惑。
及时响应学习咨询,帮助解决问题。
购买后7天内可申请无理由退款。
购买后30天内如遇降价,可申请价保。
对于提问做到有问必答,帮您扫清学习过程中的种种障碍
我觉得有必要撸一遍,毕竟粘粘的
pulic class InitCustomAttributes{
pulic void Init()
{
assembly assembly=assembly.getassembly(typeof(bindprefab))//获取bindprefab所在程序集
type[] types=assembly.getexportedtypes();//获取所有类型
foreach(type type in types)
{
foreach(attribute attribute in type.getcustomattributes(type,true))//获取所有特性, true的意思shi
{
if(attribute is bindprefab){
bindprefab date=attribute as bindprefab;
}
}
}
}
}
普通的单例类 限定条件 where T:class,new t()
如果不加上new T 会报错。
能够进行一个构造函数调用的