Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by martygrof3708 · Jun 02, 2019 at 07:44 PM · renderinggraphicsparticlescoloreffect

How can I make a color wave effect?

Basically I have a game where the player moves along tiles and must tap when the player is within a target on the tile. When this happens, I want to have a "flash" of white starting from the centre of the tile spreading outwards in all 4 directions until it hits the edge of the cube, where the flash then dissapears. I would like this flash the take the shape of a hollow square, where it's alpha fades out on the inside edges.

I am still learning Unity so please don't assume I know even basic things.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by highpockets · Jun 02, 2019 at 08:44 PM

You can fake this by making a transparent texture in the shape you want and then put it on a quad with a transparent material. Scale it down to nothing and have it slightly higher than the tile at which it makes the effect above. When you want to trigger the effect, scale up gradual via the Vector3.Lerp() function until it reaches your target size.

 Vector3.Lerp(startScale, endScale, scalingTimer);

Try that, if you have troubles, post your code.

Cheers,

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image martygrof3708 · Jun 02, 2019 at 09:23 PM 0
Share

Thank you. How exactly would I go about making a texture? lol...

avatar image highpockets martygrof3708 · Jun 02, 2019 at 09:30 PM 1
Share

In photoshop, $$anonymous$$rita, gimp, etc.. Then you can import it as a sprite into unity

avatar image martygrof3708 highpockets · Jun 03, 2019 at 01:47 AM 0
Share

Ohh I see ok. Thanks alot it really helped.

avatar image martygrof3708 · Jun 03, 2019 at 02:17 AM 0
Share

Hey, I have an issue. I gave me an error saying a non-convex mesh collider is not compatible with rigidbody, even though I dont have a rigidbody. I removed the mesh collider from the quad, and the error went away, but the ripple effect isnt showing. Im not asking you to hold my hand, but Im really confused.

 private IEnumerator Ripple()
 {
     Vector3 startScale = new Vector3(0 , 0 , 0);
     Vector3 endScale = new Vector3(2 , 2 , 2);
     float t = 0.5f;

     while (ripple.transform.localScale.x < 2)
     {
         ripple.transform.localScale = Vector3.Lerp(startScale , endScale , t);
         yield return new WaitForEndOfFrame();
     }

     Destroy(ripple);
 }
avatar image highpockets martygrof3708 · Jun 03, 2019 at 05:58 AM 1
Share

You are not updating the ‘t’ variable that represents the timer for the lerp function and you start it at 0.5f which will make the scale (1,1,1) always because it never changes. You want to start that timer at 0.0f and change it each frame. Also, that is the only thing I see wrong in the coroutine, but I don’t know where you are calling the coroutine from. You need to make sure you are not calling multiple coroutines. Post your whole script if you like

avatar image highpockets highpockets · Jun 03, 2019 at 06:34 AM 1
Share
 private IEnumerator Ripple()
  {
      Vector3 startScale = new Vector3(0 , 0 , 0);
      Vector3 endScale = new Vector3(2 , 2 , 2);
      float t = 0.0f;
 
      while (ripple.transform.localScale.x < 2)
      {
          ripple.transform.localScale = Vector3.Lerp(startScale , endScale , t);
          yield return new WaitForEndOfFrame();
          t += Time.deltaTime;
      }
 
      Destroy(ripple);
  }

That will make the scale change from (0,0,0) to (2,2,2) in 1 second

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

141 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Problems with rendering Particles 0 Answers

Overlapping particle systems 0 Answers

MaterialPropertyBlock works with DrawMesh but not DrawMeshInstanced. 0 Answers

Particle System Sub Emitter not working as expected 1 Answer

How can you represent overlapping energy fields? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges