Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

ContentManager.Exists returns true for an asset that wasn't loaded yet #325

Closed
RecursiveCall opened this issue Mar 30, 2014 · 7 comments
Closed

Comments

@RecursiveCall
Copy link
Contributor

ContentManager.Exists("someAsset") called before Content.Load("someAsset") returns true. Looking at the code it appears to me that the ContentManager is not checking whether or not the asset is in loadedAssets, but only checks the registered content resolvers.

@ArtiomCiumac
Copy link
Contributor

As far as I am aware, this method doesn't check if an asset is loaded, but it checks if an asset exists and it can be loaded.

@RecursiveCall
Copy link
Contributor Author

If that's the case, would it make sense to add "IsLoaded" to check whether or not an asset was already loaded (exists in loadedAssets)?

@ArtiomCiumac
Copy link
Contributor

I am not sure if this would add much value, as ContentManager ensures that the asset is loaded only once, and repeated Load calls will not load the asset several times.

@RecursiveCall
Copy link
Contributor Author

I'm writing an async version that derives the ContentManager. It would be easy to handle scenarios where I have to add <Type, string> into a queue of assets to be loaded if I could simply do Exists(asset). Not a big deal though.

@ArtiomCiumac
Copy link
Contributor

Maybe it would help more if we would make protected some of private methods in ContentManager? This will allow extensibility, however will not add a confusing IsLoaded method, which doesn't add much value anyway.

@RecursiveCall
Copy link
Contributor Author

The above scenario requires only loadedAssets to be protected. If it's an issue of consistency/conventions, that making all relevant methods protected works too.

ArtiomCiumac added a commit that referenced this issue Mar 31, 2014
@ArtiomCiumac
Copy link
Contributor

I made some members protected in the changeset above, however I am not sure if I fully understood your usage scenario. If these changes are ok - close the issue, otherwise - post a code fragment from which we can understand what you need to achieve.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants