简体   繁体   English

精灵套件尺寸变化

[英]Sprite Kit Size Change

I have found this bizarre thing in SpriteKit. 我在SpriteKit中发现了这个奇怪的事情。 When I create a sprite node it has a width and height of 100. 创建精灵节点时,其宽度和高度为100。 当场景为父节点时,Sprite节点的尺寸为:宽度:100,高度:100。 However when I make that sprite node the child of another node it's width and height change bizarrely. 但是,当我将该精灵节点设为另一个节点的子节点时,其宽度和高度会异常地变化。 Sprite节点的尺寸宽度为14,高度为12,当Sprite是父节点时。

What is this Bizarre behaviour? 这种奇怪的行为是什么? and how can I prevent it from happening? 以及如何防止它发生? It has started messing with many of my projects as programmatically created squares become rectangles. 随着以编程方式创建的正方形变成矩形,它开始困扰我的许多项目。

The Sprites scales are thrown out of wack. Sprites音阶不合时宜。 In reality the Sprite still has a size of 100 x 100 just it doesn't have a scale of 1,1 anymore. 实际上,Sprite的大小仍为100 x 100,只是它不再具有1,1的比例。 I think that this is a bug in Scene editor and I find it mostly occurs if I resize a sprite visually vs typing in size differences. 我认为这是场景编辑器中的一个错误,我发现如果在视觉上调整精灵的大小与键入大小差异时发生的错误多半。 To fix it just change the scales back to 1 and then manually change the size back to what it should be in the Attributes panel 要解决此问题,只需将比例更改回1,然后在“属性”面板中将其手动更改回应为的大小即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM