[英]Unity3D Rotate only image in button
我正在寻找一种无需旋转文本即可旋转按钮图像的方法。 我试图像这样修复文本的旋转:
transform.eulerAngles = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, camera.transform.eulerAngles.y + 90); // Rotation of the whole button
GetComponentInChildren<Text>().transform.localEulerAngles = Vector3.zero; // Lock rotation of the text
...可以,但是问题是文本位置随图像一起移动,就像它固定了一样。
我在互联网上进行搜索,但未找到相同的案例。 感谢帮助 !
由于您的文字是您正在旋转的按钮GameObject
的子代,因此它也会受到影响。 与其尝试反映旋转效果,不如使图像成为按钮的子元素,而仅旋转该Transform
。
button `GameObject`
— image (rotate this)
— text `Text`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.