当前位置:网站首页>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
边栏推荐
- 第六七八次作业
- js飞入js特效弹窗登录框
- C# 读取 CSV文件内数据,导入DataTable后显示
- 什么是数据中台?数据中台带来了哪些价值?_光点科技
- 7/27 training log (bit operation + suffix array)
- Leetcode:2141. The longest time to run n computers at the same time [the maximum value is two points]
- Thinking and summary of R & D Efficiency
- SQL审核工具自荐Owls
- "When you are no longer a programmer, many things will get out of control" -- talk to SUSE CTO, the world's largest independent open source company
- Three deletion strategies and eviction algorithm of redis
猜你喜欢

Space shooting Lesson 15: props

如何用Redis实现事物以及锁?

Explain the mobile control implementation of unity in detail

High beam software has obtained Alibaba cloud product ecological integration certification, and is working with Alibaba cloud to build new cooperation

Redis 3.0 source code analysis - data structure and object SDS list Dict

Network shell

LVS+KeepAlived高可用部署实战应用

阿里云 MSE 支持 Go 语言流量防护

How bad can a programmer be? Nima, they are all talents

How can enterprises successfully complete cloud migration?
随机推荐
Record an error in runtime. Getruntime().Exec ("command")
Alibaba cloud MSE supports go language traffic protection
Looking at SQL optimization from the whole process of one query
Space shooting Lesson 16: props (Part 2)
Explain the mobile control implementation of unity in detail
Huawei cloud digital asset chain, "chain" connects the digital economy, infinite splendor
Understanding of C # delegate
Space shooting Lesson 10: score (painting and writing)
Confusing knowledge points of software designer examination
Three deletion strategies and eviction algorithm of redis
PXE_ KS unattended system
一文读懂Okaleido Tiger近期动态,挖掘背后价值与潜力
[1331. Array serial number conversion]
【ADB常用命令及其用法大全(来自[醒不了的星期八]的全面总结)】
Two written interview questions about regular
Seventeen year operation and maintenance veterans, ten thousand words long, speak through the code of excellent maintenance and low cost~
What is "security"? Volvo tells you with its unique understanding and action
js win7透明桌面切换背景开始菜单js特效
[complete collection of common ADB commands and their usage (from a comprehensive summary of [wake up on Sunday)]
leetcode:2141. 同时运行 N 台电脑的最长时间【最值考虑二分】






