当前位置:网站首页>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("保存某些数据");
}
}
边栏推荐
- Selection of slow motion function
- Visio draws Tai Chi
- Unity screen coordinates ugui coordinates world coordinates conversion between three coordinate systems
- 内核判断i2c地址上是否挂载外设
- [Yu Yue education] reference materials of complex variable function and integral transformation of Northwestern Polytechnic University
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- Visio draw fan
- Chip debugging of es8316 of imx8mp
- 【LGR-109】洛谷 5 月月赛 II & Windy Round 6
- How does vs change the project type?
猜你喜欢
Sqlserver query results are not displayed in tabular form. How to modify them
RTP gb28181 document testing tool
How to realize automatic playback of H5 video
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
A blog to achieve embedded entry
麥斯克電子IPO被終止:曾擬募資8億 河南資產是股東
Easyrecovery reliable and toll free data recovery computer software
ETCD数据库源码分析——etcdserver bootstrap初始化存储
Embedded development program framework
[Chongqing Guangdong education] engineering fluid mechanics reference materials of southwestjiaotonguniversity
随机推荐
Zynq learning notes (3) - partial reconfiguration
Easyrecovery reliable and toll free data recovery computer software
Delete subsequence < daily question >
二叉树基本知识和例题
Ue5 small knowledge freezerendering view rendered objects in the cone
Scala function advanced
麥斯克電子IPO被終止:曾擬募資8億 河南資產是股東
Summary of three log knowledge points of MySQL
[try to hack] John hash cracking tool
[buuctf.reverse] 159_[watevrCTF 2019]Watshell
Upload nestjs configuration files, configure the use of middleware and pipelines
关于es8316的音频爆破音的解决
Postman管理测试用例
Meet diverse needs: jetmade creates three one-stop development packages to help efficient development
内核判断i2c地址上是否挂载外设
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
Postman测试报告
[Chongqing Guangdong education] engineering fluid mechanics reference materials of southwestjiaotonguniversity
最高法院,离婚案件判决标准
2021 RoboCom 世界机器人开发者大赛-本科组(复赛)