当前位置:网站首页>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 ");
}
}
边栏推荐
- Luogu deep foundation part 1 Introduction to language Chapter 2 sequential structure programming
- L'introduction en bourse de MSK Electronics a pris fin: 800 millions de RMB d'actifs de Henan étaient des actionnaires
- 【Try to Hack】john哈希破解工具
- Raspberry pie 3.5-inch white screen display connection
- Application of Flody
- RT thread analysis - object container implementation and function
- 力扣(LeetCode)186. 翻转字符串里的单词 II(2022.07.05)
- Dry goods collection | Vulkan game engine video tutorial
- Redis 排查大 key 的4种方法,优化必备
- 团队协作出了问题,项目经理怎么办?
猜你喜欢
二叉树基本知识和例题
ue5 小知识点 开启lumen的设置
Postman pre script - global variables and environment variables
MPLS experiment
yolov5 tensorrt加速
[FreeRTOS interrupt experiment]
[05-1, 05-02, 05-03] network protocol
Postman assertion
SQL注入漏洞(MSSQL注入)
What are the advantages of the industry private network over the public network? What specific requirements can be met?
随机推荐
Dynamic programming (tree DP)
8. Static file
[05-1, 05-02, 05-03] network protocol
RTP GB28181 文件测试工具
[Chongqing Guangdong education] Suzhou University English film and Television Appreciation reference materials
Platformio create libopencm3 + FreeRTOS project
最高法院,离婚案件判决标准
Uva1592 Database
Platformio create libopencm3 + FreeRTOS project
ISP学习(2)
[数学建模] 微分方程--捕鱼业的持续发展
关于es8316的音频爆破音的解决
也算是學習中的小總結
[noip2008 improvement group] stupid monkey
团队协作出了问题,项目经理怎么办?
Codeforces Round #804 (Div. 2)
Bill Gates posted his 18-year-old resume and expected an annual salary of $12000 48 years ago
Postman manage test cases
行业专网对比公网,优势在哪儿?能满足什么特定要求?
Chip debugging of es8316 of imx8mp