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?
A downloadable tool
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.
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.
Click download now to get access to the following files:
Log in with itch.io to leave a comment.
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 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.
* 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.
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.
This is an awesome little tool! It would be great if it supported Sorting Layers as well. Would that be possible with this shader?
I don't think so. But I'll look into this. It's an important feature.
I've just added a support for sorting layers. Should be no different from using same properties in sprites.