Search Unity

2D water problem

Discussion in '2D' started by Agent003, Jul 23, 2019.

  1. Agent003

    Agent003

    Joined:
    Sep 7, 2018
    Posts:
    55
    Hello,
    In my 2D project i added water prefab from the standard assets which comes with unity, when added it works fine (image 1.png), but when i rotate it 90 degrees to face the camera it gets weird (image 2.png).

    What is the problem, i tried many options in the asset but i didn't work, please help.
     

    Attached Files:

    • 1.PNG
      1.PNG
      File size:
      118 KB
      Views:
      482
    • 2.PNG
      2.PNG
      File size:
      67.5 KB
      Views:
      480
  2. Agent003

    Agent003

    Joined:
    Sep 7, 2018
    Posts:
    55
    I found the solution in unity answers, edit this line in the shader code:

    Code (CSharp):
    1.  temp.xyzw = wpos.xzxz * _WaveScale + _WaveOffset;
    2.  
    to this :
    Code (CSharp):
    1.  temp.xyzw = wpos.xyxy * _WaveScale + _WaveOffset;
     

    Attached Files: