- HoloLens Beginner's Guide
- Jason Odom
- 287字
- 2021-07-02 23:35:20
Prefabs
Imagine that you have been hired to build a holographic corporate team-building exercise for an upcoming weekend event. The idea is to create a scavenger hunt to find a cute robot and you have a large group of mean robots trying to stop everyone. The event is a gamified first-person shooter/scavenger hunt. The winning team will get the real robot to help in their office. It will be fun; let the team get some tension out and repair some troubled relationships in the company. From the word go, you will be using prefabs.
A prefab is a Unity asset type that acts as a blueprint or a template. In our preceding example, something as simple as the bullets for the weapons or as complex as the large collection of really mean robots that are trying to stop the entire company from achieving their goals could also be prefabs.
Fundamentally, a prefab is a hierarchical collection of GameObjects and their associated components. Using a parent/child relationship very similar to the file folder system of a computer. A developer can create a complex object made out of many objects, and then copy that object in memory. This is a process known as instantiation, but can easily be understood as cloning.
The benefit of this process is when you need to create 15 robots for a robot game, at any given time you will get more efficient use of memory. Without instantiation and prefabs, each of those robots will take up their own space in memory and potentially start to bog the system down. With this cloning process, these objects that acquire space of memory and therefore use far less memory.
- Getting Started with Citrix XenApp? 7.6
- 認(rèn)識編程:以Python語言講透編程的本質(zhì)
- 算法精粹:經(jīng)典計算機(jī)科學(xué)問題的Java實現(xiàn)
- 從程序員到架構(gòu)師:大數(shù)據(jù)量、緩存、高并發(fā)、微服務(wù)、多團(tuán)隊協(xié)同等核心場景實戰(zhàn)
- Visual Basic程序設(shè)計(第3版):學(xué)習(xí)指導(dǎo)與練習(xí)
- Ray分布式機(jī)器學(xué)習(xí):利用Ray進(jìn)行大模型的數(shù)據(jù)處理、訓(xùn)練、推理和部署
- 實戰(zhàn)Java高并發(fā)程序設(shè)計(第3版)
- Python編程:從入門到實踐
- Mastering JavaScript Design Patterns(Second Edition)
- C語言程序設(shè)計
- Programming with CodeIgniterMVC
- R Data Science Essentials
- 從零開始學(xué)Android開發(fā)
- App Inventor 2 Essentials
- Sails.js Essentials