当前位置:网站首页>Explain prefabrication in unity in detail
Explain prefabrication in unity in detail
2022-07-28 20:54:00 【Dream small day young】
Preface
stay Unity in , The function of prefabrication is to reuse resources , For example, the flowers and trees in the game world 、 House building . These resources are recurring , We can make it into a prefabricated body , Easy to reuse . Prefabrication is also divided into original prefabrication and variation , In this article, let's talk about their differences .
Catalog
Front row reminders : This article only represents personal views , For exchange and learning , If you have different opinions, please comment , The author must study hard , Day day up .
When reading this article , If there is something you don't understand , It is recommended to watch the references listed in this article for comparison .
Unity edition [2019.4.10f1] Dream small day young & Prohibited reproduced
Video Explanation :
Detailed explanation Unity The prefabrication of _BiLiBiLi
One 、 How to make a preform
The function of prefabrication is to reuse resources , Therefore, objects that are reused in the scene should be made into prefabricated bodies as much as possible and then dragged into the game
For externally imported model resources , Import is in the form of a prefabricated body
Anything that can be dragged into Hierarchy Panel , Can be made into prefabricated bodies , Including but not limited to models 、UI、 Mount the empty object of the script .
1. Make a preform
2. Function and difference
Modifying a prefab instance does not affect the original prefab
Modifying the original prefabrication will affect all prefabrication instances
Two 、 Preform variants
1. Make preform variants
The icon of the prefab variant is slightly different from that of the original prefab , Please make a distinction between .
When you drag a game object that is already a prefab into Assets At the window , Pop up window will prompt , Do you want to create another original prefab or a variant of the original prefab . We choose the second option , Then the preform variant is created successfully .
2. Original preform VS Preform variants
Prefabrication has several branch concepts , Please don't confuse
Here we can use the concept of object-oriented to understand , The primitive prefab is the base class , The original prefab instance is the instance object of the base class , Modifying the instance object of the base class has nothing to do with the base class , Modify the base class itself , It will affect all base class instances .
A prefab variant is a derived class of the original prefab ( Subclass ), Subclasses are also affected by base classes , But it can also be different from the base class , The difference is not affected by the base class , Subclasses can also New example , It's called a prefab variant instance .
3、 ... and 、 Precast body covering 、 Sync
When you are in Hierarchy The preform is modified in the window , It is not synchronized to its original preform , because Hierarchy All the prefabricated bodies are examples of prefabricated bodies , What if you synchronize the prefab instance to its original prefab ?
It is not difficult for us to find from the demonstration diagram , If a new one is added to the current precast instance Cube, Then the picture appears “+” Number , This means this Cube Newly added , It is not owned by the original preform itself , You have two choices at this time :
Reset to the shape of the original preform
Synchronize the current modification to the original preform
5、 ... and 、 Precast body nesting
If you already know the above , Preform nesting is for you , It shouldn't be a problem , We already know that the original prefabrication experience has an impact on the example , Is the original prefab composed of multiple original prefabs more flexible , You can adjust any details in different prefabricated bodies , Finally, it will have an impact on an example of precast body .
6、 ... and 、 Summary and references
1. summary
Come here , If you can flexibly use the original preform 、 Preform variants 、 Precast body nesting 、 Examples of precast units , Already can play a lot of tricks , come on. .( Attach a form )
2. Reference material
1. Own diligence and wisdom
2. official API And documentation
3. Your own clever brain
边栏推荐
- High beam software has obtained Alibaba cloud product ecological integration certification, and is working with Alibaba cloud to build new cooperation
- Unity object path query tool
- Redis 3.0 source code analysis - data structure and object SDS list Dict
- H5 wechat shooting game source code
- MySQL error: specified key was too long; max key length is 767 bytes
- 网络各层性能测试
- PXE_ KS unattended system
- JS picture hanging style photo wall JS special effect
- Report redirect after authorized login on wechat official account_ The problem of wrong URI parameters
- Want to draw a picture that belongs to you? AI painting, you can also
猜你喜欢

什么是数据中台?数据中台带来了哪些价值?_光点科技

EasyNLP中文文图生成模型带你秒变艺术家

远光软件获得阿里云产品生态集成认证,携手阿里云共建新合作

The cloud native programming challenge is hot, with 510000 bonus waiting for you to challenge!

Unity gadget displays the file size of the resource directory

Want to draw a picture that belongs to you? AI painting, you can also

UE4 3dui widget translucent rendering blur and ghosting problems

JS win7 transparent desktop switching background start menu JS special effect

JS fly into JS special effect pop-up login box

什么是“安全感”?沃尔沃用它自己独特的理解以及行动来告诉你
随机推荐
激光slam:LeGO-LOAM---代码编译安装与gazebo测试
How bad can a programmer be? Nima, they are all talents
Nat experiment demonstration (Huawei switch equipment configuration)
Fragment中使用ViewPager滑动浏览页面
不懂就问,快速成为容器服务进阶玩家!
Space shooting Lesson 13: explosion effect
Explain the mobile control implementation of unity in detail
[C language brush questions] explanation of linked list application
leetcode:2141. 同时运行 N 台电脑的最长时间【最值考虑二分】
Unity performance optimization scheme arrangement
Oracle library access is slow. Why?
Ask if you don't understand, and quickly become an advanced player of container service!
Oracle库访问很慢,是什么原因?
Beautiful blue background form input box style
全链路灰度在数据库上我们是怎么做的?
Yum package management
Use order by to sort
一文读懂Okaleido Tiger近期动态,挖掘背后价值与潜力
#yyds干货盘点# 面试必刷TOP101:链表中的节点每k个一组翻转
JS chart scatter example






