当前位置:网站首页>EditorUtility. The role and application of setdirty in untiy
EditorUtility. The role and application of setdirty in untiy
2022-07-06 04:50:00 【charlsdm】
UnityEditor.EditorUtility.SetDirty(this.gameObject);
Combine some Unity The script changes the Inspector Then change some properties on
Direct change Unity Function of prefabricated body , Used to change Inspector Save the data on
My code is attached below
[ContextMenu(" Automatically assign null to my original image ")]
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(" Save some data ");
}
}
边栏推荐
- Distributed transaction solution
- Yolov5 tensorrt acceleration
- Complete list of common functions of turtle module
- 2021robocom robot developer competition (Preliminary)
- Redis 排查大 key 的4种方法,优化必备
- [buuctf.reverse] 159_[watevrCTF 2019]Watshell
- IPv6 comprehensive experiment
- 行业专网对比公网,优势在哪儿?能满足什么特定要求?
- Leetcode 186 Flip the word II in the string (2022.07.05)
- 优秀PM必须经历这3层蜕变!
猜你喜欢
Postman关联
Redis —— Redis In Action —— Redis 实战—— 实战篇一 —— 基于 Redis 的短信登录功能 —— Redis + Token 的共享 session 应用— 有代码
麥斯克電子IPO被終止:曾擬募資8億 河南資產是股東
Distributed transaction solution
View workflow
L'introduction en bourse de MSK Electronics a pris fin: 800 millions de RMB d'actifs de Henan étaient des actionnaires
Lepton 无损压缩原理及性能分析
Sqlserver query results are not displayed in tabular form. How to modify them
Dry goods collection | Vulkan game engine video tutorial
A blog to achieve embedded entry
随机推荐
A little knowledge of CPU, disk and memory
[NOIP2008 提高组] 笨小猴
MIT CMS. 300 session 8 – immersion / immersion
The video in win10 computer system does not display thumbnails
二叉树基本知识和例题
MySQL reported an error datetime (0) null
[Chongqing Guangdong education] engineering fluid mechanics reference materials of southwestjiaotonguniversity
Request (request object) and response (response object)
What are the advantages of the industry private network over the public network? What specific requirements can be met?
web工程导入了mysql驱动jar包却无法加载到驱动的问题
动态规划(树形dp)
IPv6 comprehensive experiment
RTP GB28181 文件测试工具
11. Intranet penetration and automatic refresh
yolov5 tensorrt加速
The web project imported the MySQL driver jar package but failed to load it into the driver
Postman管理测试用例
几种RS485隔离通讯的方案介绍
[05-1, 05-02, 05-03] network protocol
canal同步mysql数据变化到kafka(centos部署)