当前位置:网站首页>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("保存某些数据");
}
}
边栏推荐
- The web project imported the MySQL driver jar package but failed to load it into the driver
- [HBZ sharing] how to locate slow queries in cloud database
- 2021robocom robot developer competition (Preliminary)
- 11. Intranet penetration and automatic refresh
- Visio draws Tai Chi
- 也算是學習中的小總結
- Dynamic programming (tree DP)
- Request (request object) and response (response object)
- The underlying structure of five data types in redis
- Ue5 small knowledge points to enable the setting of lumen
猜你喜欢

8. Static file

ue5 小知识点 开启lumen的设置
![[Yu Yue education] reference materials of complex variable function and integral transformation of Northwestern Polytechnic University](/img/22/ead74bc121a64910ef6ef374cd029b.png)
[Yu Yue education] reference materials of complex variable function and integral transformation of Northwestern Polytechnic University

Selection of slow motion function

SQL injection vulnerability (MSSQL injection)

MPLS experiment

Postman关联

你需要知道的 TCP 三次握手
![[detailed steps of FreeRTOS shift value for the first time]](/img/73/a469eb2465bb2c5acaa4d018d3edd3.jpg)
[detailed steps of FreeRTOS shift value for the first time]

Dry goods collection | Vulkan game engine video tutorial
随机推荐
MIT CMS. 300 session 8 – immersion / immersion
图论的扩展
Tengine kernel parameters
比尔·盖茨晒18岁个人简历,48年前期望年薪1.2万美元
Crazy God said redis notes
NPM command -- install dependent packages -- Usage / explanation
[buuctf.reverse] 159_ [watevrCTF 2019]Watshell
Luogu deep foundation part 1 Introduction to language Chapter 2 sequential structure programming
Redis —— Redis In Action —— Redis 实战—— 实战篇一 —— 基于 Redis 的短信登录功能 —— Redis + Token 的共享 session 应用— 有代码
内核判断i2c地址上是否挂载外设
[Chongqing Guangdong education] engineering fluid mechanics reference materials of southwestjiaotonguniversity
Extension of graph theory
[HBZ sharing] how to locate slow queries in cloud database
win10电脑系统里的视频不显示缩略图
Redis - redis in action - redis actual combat - actual combat Chapter 1 - SMS login function based on redis - redis + token shared session application - with code
It is also a small summary in learning
Zynq learning notes (3) - partial reconfiguration
Selection sort
The IPO of mesk Electronics was terminated: Henan assets, which was once intended to raise 800 million yuan, was a shareholder
[05-1, 05-02, 05-03] network protocol