Resolve: #14 FEAT: Add fallback rendering for WebGL target #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
GameObject
s for displaying.I added the
PoolFallback
class to hook into thePool
class to makeGameObject
s for the projectiles when needed. Then update the appearance inProjectileManager.UpdateBuffers
. I used a normalSpriteRenderer
for rendering and thesprite
is got from theTexture
ofProjectilePrefab
. To load the default sprite when the texture is empty, I moved the sprites to Resources folder. Also, I added a flag calledFallbackRendering
intoProjectileManager
for enabling this fallback rendering.I made sure outline prefabs will work properly as possible by setting a ceiled
sortingOrder
according toZIndez
. However, the data type isn't the same so there will be cases that don't work. If theZIndez
of two objects is0.1
and0.2
, thesortingOrder
for both of them will be ceiled to1
, causing the wrong order.