当前位置:网站首页>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
边栏推荐
- Talking about canvas and three rendering modes in unity
- 融合数据库生态:利用 EventBridge 构建 CDC 应用
- Space game Lesson 12: shield
- Sorting out problems in interface endpoint testing practice using Supertest
- [工具类] Map的util包, 常用 实体类转化为map等操作
- Nat experiment demonstration (Huawei switch equipment configuration)
- Lvs+keepalived high availability deployment practical application
- [C语言刷题篇]链表运用讲解
- Establishment of flask static file service
- Huawei cloud digital asset chain, "chain" connects the digital economy, infinite splendor
猜你喜欢

The 678th operation

Job CE

Redis入门二:redhat 6.5安装使用

Introduction to redis I: redis practical reading notes

激光slam:LeGO-LOAM---代码编译安装与gazebo测试

Cartoon JS shooting game source code

Three deletion strategies and eviction algorithm of redis

The engineering practice of super large model was polished, and Baidu AI Cloud released the cloud native AI 2.0 solution

js图表散点图例子
Looking at SQL optimization from the whole process of one query
随机推荐
LVM logical volume
漂亮的蓝色背景表单输入框样式
Introduction to redis I: redis practical reading notes
js图表散点图例子
Report redirect after authorized login on wechat official account_ The problem of wrong URI parameters
How to make the design of governance structure more flexible when the homogenization token is combined with NFT?
华为云数字资产链,“链”接数字经济无限精彩
算法面试高频题解指南【一】
How do we do full link grayscale on the database?
Space shooting Lesson 15: props
Explain several mobile ways of unity in detail
Dynamic planning: code summary of knapsack problem template
Unity performance optimization
Job CE
PL515 SOT23-5 单/双口 USB 充电协议端口控制器 百盛电子代理商
3D laser slam: Interpretation of logo-loam paper - Introduction
JS picture hanging style photo wall JS special effect
Understanding of C # delegate
UE4 3dui widget translucent rendering blur and ghosting problems
既要便捷、安全+智能,也要颜值,萤石发布北斗星人脸锁DL30F和极光人脸视频锁Y3000FV






