Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

As this post title suggest, font of the scene become disappear when same scene call more than two time.

Following code I used for creating font.

 mNumberFontTexture = new BitmapTextureAtlas(
                            alienAttack.getTextureManager(), 256, 256);
 numberFont = new Font(alienAttack.getFontManager(), mNumberFontTexture,
                            Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 52, true,
                            Color.YELLOW);

Based on requirement I load a font texture as per the following way.

    public void loadLevelSelectGraphics() {
            levelSelectBitmapTextureAtlas.load();
            mNumberFontTexture.load();
            numberFont.load();
    }

    public void unloadLevelSelectGraphics() {
            levelSelectBitmapTextureAtlas.unload();
            numberFont.unload();
    }

I am using scene base approach for developing game. Please suggest me in which thing I am doing mistake. Thanks for your effort.

EDIT

Screenshot represent the problem which was occur after multiple load and unload font method.

Font Bug

share|improve this question
    
By dissapear you mean letters become black squares or completely dissapear? –  sm4 Jun 12 '13 at 11:18
1  
Letter become completely disappear sometime or become multicolor box region sometime. Thanks for your reply. At least you show some courage to answer. –  Siddharth Jun 12 '13 at 17:19
    
If you want then I can post a screenshot also so you can better understand. Because I am working with long time with this engine and first time got this type of problem. So any how I want to detect what was going wrong. –  Siddharth Jun 13 '13 at 4:02
1  
Maybe screenshot, but post when do you call the load and unload methods. I think the problem will be there. –  sm4 Jun 13 '13 at 4:06
    
Within few minutes I will post screenshot. –  Siddharth Jun 13 '13 at 4:07
show 2 more comments

1 Answer

This happened to me in AndEngine when I loaded the texture but forgot to unload it. If I load it too many times, then the memory is full, new texture doesn't get loaded and this happens - the texture regions point to some garbage.

If it happens only after some time, it might be the case. To debug it, write a message to log on each load and each unload and make sure you load and unload the same number of times.

Also it can be another texture that fills the memory. In your example, you are loading levelSelectBitmapTextureAtlas.load(); but you are not unloading it. It might have filled your memory and there is no more space for the font.

share|improve this answer
    
This type of problem occur because I forgot to enter following line of statement in my unload graphics method. mNumberFontTexture.load(); But now another problem arise that I mention in other question. –  Siddharth Jun 14 '13 at 3:24
    
No this way I don't able to get my solution. Sorry for my misconception. –  Siddharth Jun 14 '13 at 4:11
    
I up vote you answer because I got some concept from you answer that become useful to me in future. –  Siddharth Jun 14 '13 at 4:20
    
If it did not help you but you have fixed it, please post your solution and accept it as an answer. –  sm4 Jun 16 '13 at 7:45
    
No, at present I didn't found solution for my question. But if I don't perform any loading and unloading of font for game then it is working. So I think I don't have to unload it up till I won't found any solution. –  Siddharth Jun 16 '13 at 13:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.