fabriziospadaro / SpriteSheetRenderer

Spritesheet renderer is a powerful Unity ECS API to render massive numbers of sprites using the new dots stack, taking full advantage of Jobs, DynamicBuffers and ComputeBuffer

Home Page:https://www.linkedin.com/in/fabrizio-spadaro/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid stride 1 for Compute Buffer - must be greater than 0, less or equal to 2048 and a multiple of 4.

aganm opened this issue · comments

I'm trying to use this in 2019.3 and getting this error. I'm clicking to find out where it is from, but it's not showing me anything. Can you help?

I found the cause of the issue in the UpdateBuffers function of SpriteSheetRenderer.cs. Changing the stride variable to int stride = instanceCount >= 16 * SpriteSheetManager.renderInformation[renderIndex].spriteCount ? 4 : 16 * renderInformation.spriteCount; fixed the issue for me, though I'm not sure if this is the best way.

@RoryNickolls Thanks! That solved it. Now I have an other problem but no errors. I build the 1 million sprite scene and my CPU usage is high as if it's processing the sprites, but GPU is low and nothing on screen. Do you have an idea? Does building work for you?

Not sure what's happening there. Here's my stats for 1 million animated sprites moving around
https://imgur.com/VnhX75g. Do you get any warnings that might explain it? I think I got one telling me to switch to .NET 4 first time round.

@RoryNickolls Thanks! That solved it. Now I have an other problem but no errors. I build the 1 million sprite scene and my CPU usage is high as if it's processing the sprites, but GPU is low and nothing on screen. Do you have an idea? Does building work for you?

Hello, as I said in the read me, you need .Net 4 to run this, hope this solves it, and let me know if you have any other problem.

@fabriziospadaro This bug is happening with .Net 4. Also I'm using Unity 2019.3.3. I open the BulkSpawnSprites[Demo] scene, play it in editor and it works. CPU at ~80%, GPU ~50% and 1 million sprites at ~30fps. If I build the scene, CPU at 100%, GPU at 0%, no sprite on screen.

Hello, I fixed the stride error and this fix should also solve the "no sprites on screen", let me know if you still get errors.