ios - Cocos2D - 调用另一个类中的方法时出现奇怪的警告

标签 ios methods cocos2d-iphone warnings

我必须上课、生存和 HUDLayer。 在我的 HUDLayer 中,我有一个 SneakyButton,使用该按钮我调用 Survival.m 中名为 -(void)fire 的方法,但是当我调用该方法时,我收到错误消息 CCSpriteBatchNode: resizing TextureAtlascapacity from 我知道该方法正在被调用,因为我使用 NSLog() 检查了该方法

-(void)fire {
NSLog(@"Fire");
}

在我的日志中,它返回 Fire 以及那个奇怪的警告。 当我收到警告时,fps 下降到 30 左右。有人有什么建议吗?

最佳答案

这是您可以在 cocos2d 源代码中找到有关调整纹理图集大小的内容:

// if we're going beyond the current CCTextureAtlas's capacity,
// all the previously initialized sprites will need to redo their texture coords
// this is likely computationally expensive

This is the explication正在发生的事情:

The internal array of sprites are increasing because your are adding more sprites to the batch (the log is there just to let you know on debug versions).

子节点也计入达到 Sprite 容量的限制。

您可以尝试为批处理节点设置更高的限制:

[CCSpriteBatchNode batchNodeWithFile:@"myAtlas.png" capacity:100]; // capacity for 100 objects

减少这种情况发生的频率。

关于ios - Cocos2D - 调用另一个类中的方法时出现奇怪的警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14546469/

相关文章:

iphone - iAd 出现和消失

ios - 具有可变宽度但限制在父级内的按钮 - iOS 自动布局

c++ - 指向方法父参数的子类方法指针 C++

scala - 嵌套方法的成本

c++ - 从成员 get 方法返回 const 引用

cocos2d-iphone - 动态改变 box2d 的 body 形状

ios - Flutter iOS版本因Pod文件: Podfile is out of date错误而失败

ios - 将 google map.bundle 添加到项目导致 xcode 5 停止

ios - 手动在 SKS 文件中创建的标签节点未加载

cocos2d-iphone - 在 Cocos2d 中替换场景时不会触发 dealloc