hi guy, help me! AssetManager?

Anything libgdx related goes here!

hi guy, help me! AssetManager?

Postby danhsmile043 » Wed Jun 13, 2018 4:49 pm

Hi all, thanks for taking the time to read my post. I'm new here and I've attempted to follow all the correct protocols before posting but if I've made a mistake please correct and forgive me.

I'm working on an Android application which uses LibGDX to render some characters behind Android UI. Some Activities contain a Fragment extending AndroidFragmentApplication. These Fragments have their own Adapters extending ApplicationAdapter, which currently load the necessary Textures when they're instructed which characters to render. These Textures and Atlases take a few seconds to load each time, which is the start of my problem. Each Adapter is using the same assets, so I attempted to use LibGDX's AssetManager to cache the assets and share them between my Fragments and their Adapters.

On launching my first Activity with a LibGDX Fragment using the AssetManager, things work great! The problem is that when I share this AssetManager to a new Activity through dependency injection (Dagger2) and fire up the Fragment's Adapter, the Textures come out black. I believe this is because each AndroidFragmentApplication is running on its own GLThread and Textures are not thread-safe. Since the Textures were added to the AssetManager on one thread, I'm guessing I can't access them on another.
Posts: 1
Joined: Mon Jun 11, 2018 9:15 am

Return to Libgdx

Who is online

Users browsing this forum: No registered users and 1 guest