0

EDIT 5: Optimization level build settings:

Build settings

EDIT 4: I tried to change the build configuration putting all to "Debug" and then run for "testing". Weirdly enough it didn't crash for about 20 times (I kept load and unloading various GameScenes whith different assets). At the 21st time (even if not statistically relevant) I was about to think that it might not crash anymore but it crashed. The summary is still unavailable so I am wondering if I am doing it right or if there is some other issue.. Here are the build configuration and the crash report:

Configuration

What still happens

EDIT 3: Importantly this bug happens only some times, like 1 out of 6/7 runs so I find it difficult to isolate it.

I am having some serious trouble understanding which texture is getting this NSAssert to fail. I have tried several approaches but none worked (or most likely its just me being a bit too stupid :)).

In the debugger I can see the GLuint information. Reading up on the internet I found that is a way to reference a frame (a sort of pointer).

I thought that there should be a way to retrieve the frame name from the batchNode plist file and was wondering if this GLuint number can correspond somehow to the order of the frame within the plist file.

NSAssert( !batchNode_ || texture.name == batchNode_.texture.name , @"CCSprite: Batched sprites should use the same texture as the batchnode");

/** texture name */
@property(nonatomic,readonly) GLuint name;

I tried those approaches but they catch all cases:

//From CCSprite.m
-(void) setTexture:(CCTexture2D*)texture
{

    if(!batchNode_ || texture.name != batchNode_.texture.name)
    {
CCLOG(@"");     // I added a debug here but it catches all cases..
        NSAssert( !batchNode_ || texture.name == batchNode_.texture.name , @"CCSprite: Batched sprites should use the same texture as the batchnode");
    }

EDIT: I know is kind of crazy but I paste my attempt to initialize fileName in CCTexture2D as I don't seem to be able to initialize it correctly:

- (id) initWithString:(NSString*)string dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)hAlignment vAlignment:(CCVerticalTextAlignment) vAlignment lineBreakMode:(CCLineBreakMode)lineBreakMode font:(UIFont*)uifont
{
    NSAssert( uifont, @"Invalid font");
    fileName=string;//TODO: Remove
    .....
}

The one above is the only initWithString that I was able to modify. I cannot modify the fileName property in this other one:

#elif defined(__CC_PLATFORM_MAC)

- (id) initWithString:(NSString*)string dimensions:(CGSize)dimensions hAlignment:(CCTextAlignment)hAlignment vAlignment:(CCVerticalTextAlignment)vAlignment attributedString:(NSAttributedString*)stringWithAttributes

EDIT 2: I tried to assign fileName as:

fileName = [string copy];

but it still gives me summary unavailable as reported here:

persisting issue

the problem seems to happen in setTexture during an Animation update but the fileName seems to be originally wrong.

That's how I declared the property in CCTexture2D:

@property(nonatomic, copy) NSString* fileName; //TODO Remove
Community
  • 1
  • 1
mm24
  • 9,280
  • 12
  • 75
  • 170
  • by adding the filename as property of CCTexture2D, and assign (copy) the filename when the texture was created. The gluint name is kind of like an alias for the texture on the GL side. – CodeSmile Mar 04 '13 at 19:52
  • 1
    the important bit: from the gluint name alone you can't get the filename – CodeSmile Mar 04 '13 at 20:02
  • @LearnCocos2D I am really not able to access the fileName even when I try to allocate it. Some init methods of CCTexture2D don't have fileName.. would help have an example of a modified CCTexture2D class that works or to know which init I should change. – mm24 Mar 04 '13 at 21:20
  • ignore inits without filename, make sure to copy the string or it may be gone by the tome you need it. Not on my computer atm, else I'd have a code sample. – CodeSmile Mar 04 '13 at 22:15
  • @LearnCocos2D I tried to assign it correctly (see edit2) but not sure if I have done it right. If you will have the chance to have some code samples would help :). In the meanwhile I'll try understanding if there are other similar ([string copy]) mistakes around my code that might have lead to this.. Thanks :) – mm24 Mar 05 '13 at 09:31
  • 1
    I see that none of the variables show any values. This is typical when running a release or optimized build. Make sure you actually run the debug build, and not release. If you happened to change Build Settings for debug, make sure the debug build is compiled without any code optimizations. – CodeSmile Mar 05 '13 at 21:57
  • @LearnCocos2D I tried to change it (see EDIT 4) and the summary still doesn't show. I am a bit stuck :) – mm24 Mar 06 '13 at 13:38
  • check Build Settings of target under Optimizations. And run clean build folder in Xcode (hold option key, Project menu). Reboot may also help. – CodeSmile Mar 06 '13 at 14:55
  • @LearnCocos2D Thanks but it already says 'none' under debug optimization level. I tried to reboot but was not of much help. From the build menu I choose build for 'testing'. I'll add a screenshot of what I tried. – mm24 Mar 06 '13 at 15:21

0 Answers0