unity父子物体
Its time to put your baby toys and milk bottle down, we are not taking care of tiny little gameObject babies anymore. Instead, we're gonna learn how to create child gameObjects of main gameObjects in the Hierarchy, a technique that proves to be quite useful when used with the Instantiate()
method, that we have just learned about.
是时候放下您的婴儿玩具和奶瓶了,我们不再照顾小小的gameObject婴儿了。 取而代之的是,我们将学习如何在层次结构中创建主要gameObjects的子 gameObjects,该技术在与我们刚刚学习的Instantiate()
方法一起使用时被证明非常有用。
If you have directly arrived on this tutorial, we recommend you to check our last tutorial for understanding the ongoing example.
如果您直接接触了本教程,我们建议您检查我们的上一教程以了解正在进行的示例。
If you pay close attention to the character we've created in the previous tutorial, you will notice that the fireballs just spawn out of the middle of our main game character, not from where you would expect (Like in this case, the outstretched hand).
如果您密切关注我们在上一教程中创建的角色,您会注意到火球只是从我们主要游戏角色的中间产生的,而不是您期望的位置(例如,在这种情况下,伸出的手)。
![Parenting Game Objects](https://www.studytonight.com/game-development-in-2D/images/basic-fundamentals-of-game-objects-26.png)
Now, what if instead of the character, there was an invisible gameObject that shot t