当前位置:网站首页>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);边栏推荐
- Programmers with a monthly salary of less than 30K must recite the interview stereotype. I will eat it first!
- 如何在IDEA中自定義模板、快速生成完整的代碼?
- xshell中怎么切换到root用户
- 十大券商有哪些?另外,手机开户安全么?
- Text classification using huggingface
- Interviewer: how to solve the problem of massive requests for data that does not exist in redis, which affects the database?
- Twitter launches the test of anti abuse tool "safe mode" and adds enabling prompt
- Stimulsoft Reports报告工具,Stimulsoft创建和构建报告
- 【Proteus仿真】8比特端口檢測8獨立按鍵
- 【Spark】scala基础操作(持续更新)
猜你喜欢

Yunna | fixed assets information system management, information-based fixed assets management

Comment personnaliser les modèles et générer rapidement le code complet dans l'idée?

2022-06-29: x = {a, B, C, D}, y = {e, F, G, H}, the length of the two small arrays X and Y is 4. If yes: a + e = B + F = C + G = D + H

Too voluminous ~ eight part essay, the strongest king of interview!

数据中台咋就从“小甜甜”变成了“牛夫人”?

【深度学习编译】算子编译 IR 转换

Analysis of IM instant messaging development technology on modern web

Solve the problem of repairing Visual Basic exceptions with excel/wps plug-in of choice financial terminal

Solving plane stress problem with MATLAB

【云原生】容器场景下的内核安全
随机推荐
【Games101】Transformation
外包干了三年,废的一踏糊涂...
Lower expectations
如何做好测试用例设计
Yunna | fixed assets information system management, information-based fixed assets management
The first unlucky person watching eth 2.0
【云原生】容器场景下的内核安全
PHP wechat merchant transfer to change initiating merchant transfer API
2022-06-29:x = { a, b, c, d }, y = { e, f, g, h }, x、y两个小数组长度都是4。 如果有: a + e = b + f = c + g = d + h
Seata 与三大平台携手编程之夏,百万奖金等你来拿
HC32M0+ GPIO
Vl6180x distance and light sensor hands-on experience
Solving plane stress problem with MATLAB
Go out and protect yourself
The listing of Symantec electronic sprint technology innovation board: it plans to raise 623million yuan, with a total of 64 patent applications
Yunna | advantages of fixed assets system management, what are the characteristics of fixed assets management system
What if you can't write your composition well? Ape counseling: parents should pay attention to these points
如何在IDEA中自定義模板、快速生成完整的代碼?
田口实验法
How much is the fixed asset management system and the price of the fixed asset management system