当前位置:网站首页>EditorUtility.SetDirty在Untiy中的作用以及应用
EditorUtility.SetDirty在Untiy中的作用以及应用
2022-07-06 04:49:00 【charlsdm】
UnityEditor.EditorUtility.SetDirty(this.gameObject);
结合某些Unity脚本更改物体的Inspector上的某些属性然后更改之后
直接更改Unity的预制体功能,用于更改Inspector上的数据之后保存
下边附上我的代码
[ContextMenu("自动给我原本的图片赋值为空")]
public void ClearPictureOrSpriteOrigionName()
{
string myname = null;
if (this.GetComponent<Image>() != null || this.GetComponent<SpriteRenderer>() != null)
{
if (this.GetComponent<Image>() != null)
{
myname = this.GetComponent<Image>().sprite.name;
}
else if (this.GetComponent<SpriteRenderer>() != null)
{
myname = this.GetComponent<SpriteRenderer>().sprite.name;
}
}
if (myname != null)
{
if (this.GetComponent<Image>() != null)
{
this.GetComponent<Image>().sprite = null;
}
else if (this.GetComponent<SpriteRenderer>() != null)
{
this.GetComponent<SpriteRenderer>().sprite = null;
}
UnityEditor.EditorUtility.SetDirty(this.gameObject);
Debug.Log("保存某些数据");
}
}
边栏推荐
- NPM command -- install dependent packages -- Usage / explanation
- Uva1592 Database
- Raspberry pie 3.5-inch white screen display connection
- L'introduction en bourse de MSK Electronics a pris fin: 800 millions de RMB d'actifs de Henan étaient des actionnaires
- CADD course learning (7) -- Simulation of target and small molecule interaction (flexible docking autodock)
- acwing周赛58
- Biscuits (examination version)
- ISP学习(2)
- Delete subsequence < daily question >
- RTP GB28181 文件测试工具
猜你喜欢
Sorting out the latest Android interview points in 2022 to help you easily win the offer - attached is the summary of Android intermediate and advanced interview questions in 2022
[Yu Yue education] reference materials of complex variable function and integral transformation of Northwestern Polytechnic University
yolov5 tensorrt加速
How to estimate the population with samples? (mean, variance, standard deviation)
canal同步mysql数据变化到kafka(centos部署)
Delete subsequence < daily question >
Use sentinel to interface locally
Why does MySQL need two-phase commit
麦斯克电子IPO被终止:曾拟募资8亿 河南资产是股东
Zynq learning notes (3) - partial reconfiguration
随机推荐
Complete list of common functions of turtle module
SQL注入漏洞(MSSQL注入)
I'd like to ask about the current MySQL CDC design. In the full volume phase, if a chunk's binlog backfill phase,
ISP学习(2)
Etcd database source code analysis -- etcdserver bootstrap initialization storage
Nestjs配置文件上传, 配置中间件以及管道的使用
Chip debugging of es8316 of imx8mp
[FreeRTOS interrupt experiment]
优秀PM必须经历这3层蜕变!
动态规划(树形dp)
CADD course learning (8) -- virtual screening of Compound Library
Platformio create libopencm3 + FreeRTOS project
acwing周赛58
ue5 小知识 FreezeRendering 查看视锥内渲染的物体
Microservice resource address
Selection sort
[Chongqing Guangdong education] Suzhou University English film and Television Appreciation reference materials
Postman assertion
二叉树基本知识和例题
2021robocom robot developer competition (Preliminary)