- HoloLens Beginner's Guide
- Jason Odom
- 336字
- 2021-07-02 23:35:21
Parent/Child relationship
Before we make our first prefab, a concept that is both useful and important is parentage. In our Hierarchy view, we can have GameObjects with other GameObjects attached to them in a Hierarchy. We call the primary objects as parents, and the secondary objects are called children. When these hierarchies exist, there are many benefits from an organizational standpoint as well as for practical application.
Where there is a series of objects connected together in such a manner, if something on the parent object is changed--such as being moved, rotated, or scaled--all the attached objects do the same in relation to the parent.
Parenting is something that also applies to prefabs. With that in mind, we will parent our objects in the scene together and make a prefab from them; let's perform the following steps:
- Take a look at our Hierarchy view; we should still have Platform, Hello, and World:
- Select Hello and drag it up onto Platform until you see a light blue oval over the destination. Then, release the mouse button:
- Now, do the same thing for the World object. After you are done, you should see this in your Hierarchy view; your Hello and World objects are now children of Platform:

If you click on the Play button now to test your app, even after parenting the Hello and World objects, they will fall onto the Platform.
Here's a quick test to see the effect on the children when we transform the parent. Let's look at the following steps:
- With Platform selected, move your mouse to the Transform component in the Inspector. Click in the Z-axis box. Change the number in the field to 4:

- Now, click on and drag the Z axis left and right to move the platform:
As you can see, the words follow along without any issue. If you were to do the same thing to the scale on the X axis, it would squeeze and expand.
- Raspberry Pi for Python Programmers Cookbook(Second Edition)
- Bulma必知必會
- Mastering Julia
- Redis Essentials
- Node.js全程實例
- Learning Modular Java Programming
- JavaScript應用開發實踐指南
- Building Serverless Architectures
- Red Hat Enterprise Linux Troubleshooting Guide
- Python計算機視覺與深度學習實戰
- Kohana 3.0 Beginner's Guide
- Building Clouds with Windows Azure Pack
- 精益軟件開發管理之道
- Django 2.0 入門與實踐
- Go語言Hyperledger區塊鏈開發實戰