Unity2D:缩放游戏对象而不缩放其子对象 [英] Unity2D: Scale a GameObject without Scaling its Children

查看:51
本文介绍了Unity2D:缩放游戏对象而不缩放其子对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个敌人,里面有孩子;敌人也有死亡动画.在死亡动画中(使用动画师),我将敌人缩放到合适的大小.然而,敌人内部的孩子也被缩小了,即使我在我已经调整大小的孩子上有一个动画,我还在这个孩子上添加了锚点位置.有没有办法可以缩小敌人的规模,同时保持孩子的大小,ps.child 是一个 UI 文本对象.谢谢!

I have an enemy that has children in it; the enemy also has a death animation. Within the death animation (using the animator), I have scaled the enemy to an appropriate size. However, the children within the enemy is also being scaled down even though I have a animation on the child where I have sized it, I also added anchor positions on this child. Is there a way I can scale down the enemy but also keep the size of the child, p.s. the child is a UI text object. Thank you!

推荐答案

我认为解决您的问题的最简单方法是在层次结构中引入另一个 GameObject.

The easiest way to solve your problem that I see is to introduce another GameObject higher in the hierarchy.

这个 GameObject 将是你的敌人对象和你的 Text 对象的父对象,该对象当前是敌人的孩子.

This GameObject would be the parent of your enemy object and your Text object which currently is a child of the enemy.

这样你就可以独立于 Text 缩放敌人.

This way you can scale the enemy independently of the Text.

这篇关于Unity2D:缩放游戏对象而不缩放其子对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆