gpt4 book ai didi

c# - Unity3D局部问题

转载 作者:行者123 更新时间:2023-12-02 17:40:26 26 4
gpt4 key购买 nike

以下代码:

Debug.LogWarning("updating scale fix, scalefactor: "+scaleFactor+" - Current scale is: "+cell.transform.localScale.x);
cell.transform.localScale.Set (scaleFactor,scaleFactor,scaleFactor);
Debug.LogWarning("Scale after fix: " + cell.transform.localScale.x);

产生以下输出:

updating scale fix, scalefactor: 0.9 - Current scale is 0.8921105
UnityEngine.Debug:LogWarning(Object)

Scale after fix: 0.8921105
UnityEngine.Debug:LogWarning(Object)

有什么想法吗?我只是假设,由于这些事情紧接着发生,因此应该更新规模。还是在帧完成后发生?

感谢任何帮助。

最佳答案

localScale 是一个属性,因此它返回真实 localScale 的副本(Vector3 是一个结构)尝试 cell.transform.localScale = new Vector3 (scaleFactor, scaleFactor, scaleFactor);cell.transform.localScale = Vector3.one * scaleFactor;

关于c# - Unity3D局部问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21539119/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com