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

Sprite destruction effect #100

Open
buihuuloc opened this issue Jul 18, 2018 · 8 comments
Open

Sprite destruction effect #100

buihuuloc opened this issue Jul 18, 2018 · 8 comments

Comments

@buihuuloc
Copy link

Hi @mob-sakai
Have you ever think about this effect?

@mob-sakai
Copy link
Owner

Hi @buihuuloc

What is "destruction effect"?
Do you have any images or videos of examples?

@buihuuloc
Copy link
Author

Hi
You can check this open source.
https://github.com/mjholtzem/Unity-2D-Destruction

@mob-sakai
Copy link
Owner

Hmm...

The effect is so cool, but not for UI.
It probably can be implemented for UI, but there are some disadvantages.

@mob-sakai
Copy link
Owner

In this effect, Physics moves UI elements (with Rigidbody component).
When the UI element moves, Canvas rebuilds the layout with overhead.

@mob-sakai
Copy link
Owner

When dividing the mesh, it needs to be rendered as each mesh.
It would be difficult to use other effects (such as UIShadow) together.

@mob-sakai
Copy link
Owner

When implementing for UI, the compromise is as follows.

  1. Can not use with Physics
  2. Can not use with other effects

@buihuuloc
Copy link
Author

  • Agree with you that It doesn't need to be used with Physics.
  • The Canvas rebuilds issue. I think this effect is for special cases, so It can have its own canvas.
  • For the motion: I think It can have a basic movement and can be extended

@mob-sakai
Copy link
Owner

mob-sakai commented Jul 18, 2018

I see.

It can be implemented like a particle system.
That is, the "particle" data array and the simulation function update the mesh.
There is only one game object, component and renderer.

Implement the UIExplosion component as follows.

  1. UIExplosion.MeshModify: UI elements are divided into multiple polygons and converted to mesh
  2. Set mesh with CanvasRenderer.SetMesh
  3. The simulation function updates the mesh according to "particle" data array and elapsed time

The nice thing about this implementation is "Canvas will not rebuild."
Also, you do not need a shader, you can use it with other effects.

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

No branches or pull requests

2 participants