当前位置:网站首页>The unity editor randomly generates objects. After changing the scene, the problem of object loss is solved
The unity editor randomly generates objects. After changing the scene, the problem of object loss is solved
2022-06-30 01:02:00 【Daily dead cycle】
Preface :
obj= (GameObject) PrefabUtility.InstantiatePrefab(configData.bigMainScene);When I develop the editor, I instantiate the prefab into the scene , After jump scene , Then returning to the scene of the instantiated object will cause the object we created before to be lost , This situation ! Very pit , Because there will be no prompt for unsaved scenes , Record the solution here
solve :
I don't think this is a complete solution , But this method is the same as when we right-click to create an object , Give Way Unity Save it for us again , Record it in the cancellation data , That's it , The code is as follows , Mainly used PrefabUtility .UnpackPrefabInstance() This method .
Details please see API
Unity - Scripting API: PrefabUtility.UnpackPrefabInstance
obj = (GameObject) PrefabUtility.InstantiatePrefab(configData.smallMainScene);
PrefabUtility.UnpackPrefabInstance(obj, PrefabUnpackMode.OutermostRoot, InteractionMode.UserAction);边栏推荐
- PHP wechat merchant transfer to change initiating merchant transfer API
- 传统微服务框架如何无缝过渡到服务网格 ASM
- Seata et les trois plateformes travaillent main dans la main pour programmer Summer, un million de bonus vous attend
- 数字垃圾是什么?跟随世界第一位AI艺术家,探索元碳艺术
- Online text digit recognition list summation tool
- 【Spark】scala基础操作(持续更新)
- How to design test cases
- 阿于的彩虹桥
- [mrctf2020]ezpop-1 | PHP serialization
- Which department should the company's fixed assets be managed? How should the company's fixed assets be managed
猜你喜欢

开发者,为什么说容器技术的成熟预示着云原生时代的到来?

测试用例设计方法之等价类划分方法

Online text digit recognition list summation tool

Outsourcing work for three years, waste a step confused

Common settings in idea

如何在IDEA中自定義模板、快速生成完整的代碼?

Crmeb SMS for program configuration of knowledge payment system

ResizeKit2.NET大小和分辨率独立

Analysis of natural frequency and buckling load of cylinder by finite element method

解决choice金融终端Excel/Wps插件修复visual basic异常
随机推荐
Newton method (optimization of two variable functions)
Twitter launches the test of anti abuse tool "safe mode" and adds enabling prompt
shell 规范日期格式
Solve the problem of repairing Visual Basic exceptions with excel/wps plug-in of choice financial terminal
如何在IDEA中创建Module、以及怎样在IDEA中删除Module?
Wechat applet - requestsubscribemessage:fail can only be invoked by user tap gesture
DL: deep learning model optimization model training skills summary timely automatic adjustment of learning rate implementation code
Yunna | fixed assets information system management, information-based fixed assets management
How to view the size of all files in a folder?
岁月不饶人
[three.js] Web3D first experience
How much is the fixed asset management system and the price of the fixed asset management system
Crmeb SMS for program configuration of knowledge payment system
HC32M0+ GPIO
传统微服务框架如何无缝过渡到服务网格 ASM
解决choice金融终端Excel/Wps插件修复visual basic异常
Practical application of information security
字节面试惨遭滑铁卢:一面就被吊打,幸得华为内推,三面拿到offer
Netease cloud music beta music social app "mus" matches friends of the same frequency through music
Sfdp 超级表单开发平台 V6.0.4 正式发布