当前位置:网站首页>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 ");
}
}
边栏推荐
- MPLS experiment
- Excellent PM must experience these three levels of transformation!
- 组播和广播的知识点梳理
- Quatre méthodes de redis pour dépanner les grandes clés sont nécessaires pour optimiser
- Redis —— Redis In Action —— Redis 实战—— 实战篇一 —— 基于 Redis 的短信登录功能 —— Redis + Token 的共享 session 应用— 有代码
- Zynq learning notes (3) - partial reconfiguration
- Request (request object) and response (response object)
- The underlying structure of five data types in redis
- Crazy God said redis notes
- Bill Gates posted his 18-year-old resume and expected an annual salary of $12000 48 years ago
猜你喜欢

Redis —— Redis In Action —— Redis 实战—— 实战篇一 —— 基于 Redis 的短信登录功能 —— Redis + Token 的共享 session 应用— 有代码

麦斯克电子IPO被终止:曾拟募资8亿 河南资产是股东
![[Chongqing Guangdong education] engineering fluid mechanics reference materials of southwestjiaotonguniversity](/img/ac/93a64e59592e3d083a771b993d6884.jpg)
[Chongqing Guangdong education] engineering fluid mechanics reference materials of southwestjiaotonguniversity

Lepton 无损压缩原理及性能分析

The underlying structure of five data types in redis

二叉树基本知识和例题

Unity screen coordinates ugui coordinates world coordinates conversion between three coordinate systems

Extension of graph theory

What are the advantages of the industry private network over the public network? What specific requirements can be met?

Selection of slow motion function
随机推荐
Digital children < daily question> (Digital DP)
ORM aggregate query and native database operation
项目经理,你会画原型嘛?项目经理需要做产品设计了?
Yyds dry goods inventory OSI & tcp/ip
Platformio create libopencm3 + FreeRTOS project
也算是學習中的小總結
IPv6 comprehensive experiment
树莓派3.5寸屏幕白屏显示连接
Uva1592 Database
acwing周赛58
Codeforces Round #804 (Div. 2)
Nestjs配置文件上传, 配置中间件以及管道的使用
SharedPreferences source code analysis
Database - MySQL storage engine (deadlock)
[NOIP2009 普及组] 分数线划定
L'introduction en bourse de MSK Electronics a pris fin: 800 millions de RMB d'actifs de Henan étaient des actionnaires
Introduction of several RS485 isolated communication schemes
A little knowledge of CPU, disk and memory
Lepton 无损压缩原理及性能分析
The underlying structure of five data types in redis