当前位置:网站首页>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()
边栏推荐
- js小练习----分时提醒问候、表单密码显示隐藏效果、文本框焦点事件、关闭广告
- .net core 访问不常见的静态文件类型(MIME 类型)
- Please ask a question, flick Oracle CDC, read a table without update operation, and repeatedly read the full amount of data every ten seconds
- 2018年江苏省职业院校技能大赛高职组“信息安全管理与评估”赛项任务书
- How to share the same storage among multiple kubernetes clusters
- Several index utilization of joint index ABC
- How can gyms improve their competitiveness?
- Basic introduction of JWT
- Mysql---- import and export & View & Index & execution plan
- Use of completable future
猜你喜欢

数据资产管理与数据安全国内外最新趋势

Maze games based on JS

. Net core accesses uncommon static file types (MIME types)

Brand · consultation standardization

Release notes of JMeter version 5.5
![How to model and simulate the target robot [mathematical / control significance]](/img/bd/79f6338751b6773859435c54430ec3.png)
How to model and simulate the target robot [mathematical / control significance]

DHCP路由器工作原理

Complete process of MySQL SQL

CompletableFuture使用详解

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
随机推荐
Matlab tips (30) nonlinear fitting lsqcurefit
js小练习
Abnova membrane protein lipoprotein technology and category display
$refs: get the element object or sub component instance in the component:
RuntimeError: CUDA error: CUBLAS_ STATUS_ ALLOC_ Failed when calling `cublascreate (handle) `problem solving
Unity3d learning notes
Abnova circulating tumor DNA whole blood isolation, genomic DNA extraction and analysis
from . onnxruntime_ pybind11_ State Import * noqa ddddocr operation error
transform-origin属性详解
什么情况下考虑分库分表
Pass parent component to child component: props
Release notes of JMeter version 5.5
Paranoid unqualified company
父组件传递给子组件:Props
Special behavior of main function in import statement
MATLAB小技巧(30)非线性拟合 lsqcurefit
关于数据库数据转移的问题,求各位解答下
Databinding exception of kotlin
Use of completable future
Brand · consultation standardization