当前位置:网站首页>Unity C function notes
Unity C function notes
2022-07-07 07:10:00 【Shallot man】
Find a component of a child object
public T FindTransform<T>(string name, Transform trans) where T : Component
{
foreach (T c in trans.GetComponentsInChildren<T>())
{
if (c.name == name)
{
return c;
}
}
return null;
}
obtain RenderFeature
private static readonly Dictionary<ScriptableRenderer, Dictionary<string, ScriptableRendererFeature>> s_renderFeatures = new Dictionary<ScriptableRenderer, Dictionary<string, ScriptableRendererFeature>>();
public static ScriptableRendererFeature GetRendererFeature(this ScriptableRenderer renderer, string name)
{
if (!s_renderFeatures.TryGetValue(renderer, out var innerFeatures))
{
var propertyInfo = renderer.GetType().GetProperty("rendererFeatures", BindingFlags.Instance | BindingFlags.NonPublic);
List<ScriptableRendererFeature> rendererFeatures = (List<ScriptableRendererFeature>)propertyInfo?.GetValue(renderer);
if (rendererFeatures == null)
{
s_renderFeatures[renderer] = null;
}
else
{
innerFeatures = new Dictionary<string, ScriptableRendererFeature>();
for (var i = 0; i < rendererFeatures.Count; i++)
{
var feature = rendererFeatures[i];
innerFeatures[feature.name] = feature;
}
s_renderFeatures[renderer] = innerFeatures;
}
}
if (innerFeatures != null)
{
innerFeatures.TryGetValue(name, out var result);
return result;
}
return null;
}
Get all subclass types that inherit a parent class
TypeCache.TypeCollection types = TypeCache.GetTypesDerivedFrom<ScriptableRendererFeature>();
foreach (Type type in types)
{
Debug.Log(type);
}
OnValidate Detailed explanation
/// Timeline Not trigger OnValidate()
边栏推荐
- 詳解機器翻譯任務中的BLEU
- Multidisciplinary integration
- Abnova membrane protein lipoprotein technology and category display
- A slow SQL drags the whole system down
- After the promotion, sales volume and flow are both. Is it really easy to relax?
- 2018年江苏省职业院校技能大赛高职组“信息安全管理与评估”赛项任务书
- 请教一下,监听pgsql ,怎样可以监听多个schema和table
- Under what circumstances should we consider sub database and sub table
- 【mysqld】Can't create/write to file
- Select the product attribute pop-up box to pop up the animation effect from the bottom
猜你喜欢
云备份项目
From zero to one, I will teach you to build the "clip search by text" search service (2): 5 minutes to realize the prototype
Matlab tips (29) polynomial fitting plotfit
Data of all class a scenic spots in China in 2022 (13604)
Answer to the second stage of the assignment of "information security management and evaluation" of the higher vocational group of the 2018 Jiangsu Vocational College skills competition
2018年江苏省职业院校技能大赛高职组“信息安全管理与评估”赛项任务书第一阶段答案
Big coffee gathering | nextarch foundation cloud development meetup is coming
CompletableFuture使用详解
How can clothing stores make profits?
【NOI模拟赛】区域划分(结论,构造)
随机推荐
MATLAB小技巧(29)多项式拟合 plotfit
MOS tube parameters μ A method of Cox
Select the product attribute pop-up box to pop up the animation effect from the bottom
Leetcode t1165: log analysis
Abnova circulating tumor DNA whole blood isolation, genomic DNA extraction and analysis
Advantages of using net core / why
This article introduces you to the characteristics, purposes and basic function examples of static routing
Under what circumstances should we consider sub database and sub table
Composition API 前提
MySql用户权限
Learning records on July 4, 2022
MySQL SQL的完整处理流程
栈题目:有效括号的嵌套深度
多线程与高并发(9)——AQS其他同步组件(Semaphore、ReentrantReadWriteLock、Exchanger)
Nesting and splitting of components
大咖云集|NextArch基金会云开发Meetup来啦
Special behavior of main function in import statement
MySQL view bin log and recover data
SolidWorks的GB库(钢型材库,包括铝型材、铝管等结构)安装及使用教程(生成铝型材为例)
AVL树的实现