当前位置:网站首页>Unity编辑器随机生成物体,更换场景之后物体丢失问题解决
Unity编辑器随机生成物体,更换场景之后物体丢失问题解决
2022-06-30 00:57:00 【每天死循环】
前言:
obj= (GameObject) PrefabUtility.InstantiatePrefab(configData.bigMainScene);我在编辑器开发的时候实例化预制体到场景中之后,在跳转场景之后,然后在返回实例化过物体的场景会导致之前我们创建的物体会丢失,这种情况!很坑,因为也不会提示未保存场景之类的,在这里记录下问题解决办法
解决:
我这也不算完全解决把,只不过这个方法会跟咱们右键创建物体的时候是一个道理,让Unity重新给咱们保存一下,记录到撤销数据里面,这样就解决了,代码如下,主要是用到了PrefabUtility .UnpackPrefabInstance()这个方法。
详情请看API
Unity - Scripting API: PrefabUtility.UnpackPrefabInstance
obj = (GameObject) PrefabUtility.InstantiatePrefab(configData.smallMainScene);
PrefabUtility.UnpackPrefabInstance(obj, PrefabUnpackMode.OutermostRoot, InteractionMode.UserAction);边栏推荐
- 解决choice金融终端Excel/Wps插件修复visual basic异常
- Analysis of IM instant messaging development technology on modern web
- Programmers with a monthly salary of less than 30K must recite the interview stereotype. I will eat it first!
- [lorawan node application] the application and power consumption of Anxin ra-08/ra-08h module in lorawan network
- Online sql to CSV tool
- 2022-06-29:x = { a, b, c, d }, y = { e, f, g, h }, x、y两个小数组长度都是4。 如果有: a + e = b + f = c + g = d + h
- 如何在IDEA中创建Module、以及怎样在IDEA中删除Module?
- What are the top ten securities companies? In addition, is it safe to open a mobile account?
- 在线文本数字识别列表求和工具
- Mysql Duplicate entry ‘xxx‘ for key ‘xxx‘
猜你喜欢

太卷了~ 八股文,面试最强王者!

Seata 与三大平台携手编程之夏,百万奖金等你来拿

Mysql Duplicate entry ‘xxx‘ for key ‘xxx‘

Bytek suffered a disastrous defeat in the interview: he was hanged on one side, but fortunately Huawei pushed him in, and he got an offer on three sides
![[qnx hypervisor 2.2 user manual]6.2.2 communication between guest and host](/img/a4/a84f916d3aa2cc59f5b686cd32797a.png)
[qnx hypervisor 2.2 user manual]6.2.2 communication between guest and host

The SQL statement concat cannot find the result
Flask web minimalist tutorial (III) - Sqlalchemy (part a)

Cloud, IPv6 and all-optical network

简单的页面

Text classification using huggingface
随机推荐
Simple pages
Mysql Duplicate entry ‘xxx‘ for key ‘xxx‘
在线文本数字识别列表求和工具
HC32M0+ GPIO
How to customize templates and quickly generate complete code in idea?
干外包3年,真废了...
玉米地里的小鸟
[cloud native] kernel security in container scenario
C语言课设心得之“推箱子”课设作品开源分享
2022 6 月25 日交易总结
Ml: introduction to confidence interval (the difference and relationship between precision / accuracy / accuracy), use method, and detailed introduction to case application
字节面试惨遭滑铁卢:一面就被吊打,幸得华为内推,三面拿到offer
外包干了三年,废的一踏糊涂...
Good test / development programmers vs. average programmers
How to design test cases
Outsourcing work for three years, waste a step confused
[recommended] how to quickly locate a bug during testing
【Games101】Transformation
在线SQL转CSV工具
Database learning notes (sql03)