question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why does LoadSpriteAtlas only work with uncompiled png's?

See original GitHub issue

NezContentManager.LoadSpriteAtlas expects a texture adjacent to the sprite atlas, and it must be a png. Why doesnt it use the content manager for this and just get the texture with the same asset name? The justification for this isnt immediately obvious to me.

I’ve accomplished this in a hacky and naive way, but it works: https://github.com/dresswithpockets/Nez/blob/master/Nez.Portable/Assets/NezContentManager.cs#L176

public SpriteAtlas LoadSpriteAtlas(string name, bool premultiplyAlpha = false)
{
	// ...
	var atlasData = SpriteAtlasLoader.ParseSpriteAtlasData($"Content/{name}.atlas");
	var atlas = atlasData.AsSpriteAtlas(ReadAsset<Texture2D>(name, null));
	// ...
	return atlas;
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
prime31commented, Dec 2, 2020

To each their own. After having written a dozen or so processors using the XNA API and maintaining them for 5+ years it was a massive relief to fall back to a makefile and just load my data without going through Content class at all.

0reactions
redthing1commented, Dec 30, 2020

@dresswithpockets if you really want to use the old pipeline loaders, you can grab them from the commit history, they’ll in all likelihood continue to work just fine. I was using them in my fork of Nez recently with no issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found