Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve: #14 FEAT: Add fallback rendering for WebGL target #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JiaChen-Zeng
Copy link

@JiaChen-Zeng JiaChen-Zeng commented Jan 3, 2022

Tested on WebGL and Windows build. Both are working properly.

https://imgur.com/a/ATjwzvZ
https://drive.google.com/file/d/1ufoGV9TQzfnOK93pPi4ujVC8HG5ceZi8/view?usp=sharing (Seems imgur can't handle this video well)

I made a workaround for the WebGL build. The custom shader can't render properly so I decided to use normal GameObjects for displaying.

I added the PoolFallback class to hook into the Pool class to make GameObjects for the projectiles when needed. Then update the appearance in ProjectileManager.UpdateBuffers. I used a normal SpriteRenderer for rendering and the sprite is got from the Texture of ProjectilePrefab. To load the default sprite when the texture is empty, I moved the sprites to Resources folder. Also, I added a flag called FallbackRendering into ProjectileManager for enabling this fallback rendering.

I made sure outline prefabs will work properly as possible by setting a ceiled sortingOrder according to ZIndez. However, the data type isn't the same so there will be cases that don't work. If the ZIndez of two objects is 0.1 and 0.2, the sortingOrder for both of them will be ceiled to 1, causing the wrong order.

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

Successfully merging this pull request may close these issues.

1 participant