A downloadable tool

Download NowName your own price

WavySprite is an asset for Unity that creates a wave animation for an image.

It creates a quad and allows you to set a texture, a number of horizontal and vertical divisions for it and multiple parameters to control the sine wave. The animation itself is done by a shader, not by a script.

To add a WavySprite object to you scene, go to:
GameObject > 2D Object > WavySprite

Hit play to see the animation. You can adjust parameters from the inspector or from code on the fly.

Check out my other assets!


2017-05-02 - Added support for sorting layers. Works same way as for sprites.

2017-05-11 - Added a button to scale the GameObject to the size of original texture.

2017-10-27 - Added a Tint option that works same way as for sprites.


Published Apr 29, 2017
StatusReleased
CategoryTool
Rating
(5)
AuthorAndrii
Made withUnity
Tags2D, animation, asset, Ludum Dare 38, Unity, unity3d, wave, wavy

Download

Download NowName your own price

Click download now to get access to the following files:

WavySprite v1.02.unitypackage 646 kB

Comments

Log in with itch.io to leave a comment.

Hi, This asset is so great and life saver to my project. Could you make it work with "Draw mode: Tiled" option from Unity's sprite render?

I'll look into it.

This asset is awesome but it only works in Unity's editor :/

I get this error in build :

(Filename: C:/Users/gabwi/Dropbox/[DOSSIER GABRIEL]/PROJETS/Lazers/Assets/WavySprite/Scripts/WavySprite.cs Line: 148)

ArgumentNullException: Argument cannot be null.
Parameter name: shader
  at (wrapper managed-to-native) UnityEngine.Material:CreateWithShader (UnityEngine.Material,UnityEngine.Shader)
  at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00000] in <filename unknown>:0   at WavySprite.SetMeshAndMaterial () [0x00075] in C:\Users\gabwi\Dropbox\[DOSSIER GABRIEL]\PROJETS\Lazers\Assets\WavySprite\Scripts\WavySprite.cs:148   at WavySprite.Update () [0x000c8] in C:\Users\gabwi\Dropbox\[DOSSIER GABRIEL]\PROJETS\Lazers\Assets\WavySprite\Scripts\WavySprite.cs:88

Weird. It should work across the board. It looks like the script fails to set a material. I'll check it and get back to you.

It works well for me and I can't reproduce this bug. But one thing that can help you is to add this shader toy our build. 

Go to: Edit > Project settings > Graphics. And at the bottom there's a way to include shaders to your project. Drag WavySprite into there, it's in WavySprite/Shaders.

I hope this helps.

Thanks ! This is working :)

Thanks for the asset, it's been a massive help. I bumped into a problem while using it and wanted to share my solution. Maybe you could comment or integrate it into the asset?

The problem is that WavySprite sprites flash white when the GameObject is enabled for the first time at runtime. It seems to be caused by the private _texture property being set only in Update(), and not while the GameObject is disabled.

To reproduce: 

* create a GameObject with a sprite and a WavySprite component, set everything up

* disable the object

* run the scene

* enable the GameObject in Play Mode

The object should flash white (mesh is textured white) for one frame.

I solved it by adding a call to Update() from OnEnable() so everything gets set up before the object is drawn.


Cheers again for the asset, it's wonderful.

Makes sense, I'll try this out and will add this.

Is there a way to sustain older values of the sine wave on a large horizontal canvas upon dynamically changing  amplitude and frequency?

If you mean that you want to change the values back and forth during gameplay then you can do it with code.

No I mean something like this..

where the earlier values sustains and can be observed later in the graph as if you were just plotting a graph instead of waving flag using the same approach.

Honestly, I don't think it can be done with that shader. I wouldn't know where to start.

(+1)

This is an awesome little tool! It would be great if it supported Sorting Layers as well. Would that be possible with this shader?

(+1)

I don't think so. But I'll look into this. It's an important feature.

Awesome! Thank you! :)

(+1)

I've just added a support for sorting layers. Should be no different from using same properties in sprites.

(+1)

Works perfectly! Thanks for the speedy update :D