在我的 Sprite Kit 游戏中,我使用了几个 SKLabelNodes ..在其中大多数我运行 SKActions。在各种 iOS 模拟器以及设备(iPhone 6)上一切正常。但!..在所有 Testflight 设备(包括一些 iPhone 6)上,一个标签永远不会出现!
怎么可能?
在我的 Sprite Kit 游戏中,我使用了几个 SKLabelNodes ..在其中大多数我运行 SKActions。在各种 iOS 模拟器以及设备(iPhone 6)上一切正常。但!..在所有 Testflight 设备(包括一些 iPhone 6)上,一个标签永远不会出现!
怎么可能?
我建议设置.name
SKLabelNode 的属性以及场景中的所有其他节点,并使用一些日志语句进行测试:
(假设你去missingLabelNode.name = @"Missing";
:)
// make sure the Label Node has been added to the scene
NSLog(@"%@ label", [self childNodeWithName:@"Missing"].name);
在您确定之后,日志会打印“缺少标签”..
// Find the coordinates of the Label Node
NSLog(@"Located at X:%f Y:%f" [self childNodeWithName:@"Missing"].position.x, [self childNodeWithName:@"Missing"].position.y);
// If you've added it to a different layer of the scene, or another node
NSLog(@"Inside Parent:%@" [[self childNodeWithName:@"Missing"] parent].name);
您现在应该确定它在场景中的坐标和存在。如果它是场景本身以外的节点的子节点,您还可以通过使用[self convertPoint:missingLabelNode.position toNode:self]
和记录这些坐标来转换它的位置。
最后,如果你确定它应该在场景的视觉范围内,我会检查它的 zPosition。在其他节点后面很容易丢失一个节点。将 zPosition 属性增加到您设置的最高索引。如果您没有设置任何其他节点的 zPositions,请使用missingLabelNode.zPosition = 10.0f;
以将其带到节点层次结构的顶部。
这应该可以解决问题。