Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Particle effect on a sprite only?

Discussion in '2D' started by bluebamf1, Jul 12, 2022.

  1. bluebamf1

    bluebamf1

    Joined:
    Jun 2, 2022
    Posts:
    8
    Is it possible to show a particle effect only within the bounds of a 2D sprite?

    For example: if I was to make a bubble gun I want particles to only show within the chamber of the gun. Right now the particles flow outside of the chamber of the gun onto everything else.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,954
    I would use a separate material for the chamber, and have a RenderTexture that provides a moving image of the bubble effect of your particle system.

    Then you would put a separate camera to create that bubble texture from the particle system somewhere else far away or on a different layer. See attached for an example, or just google for RenderTexture setup examples.
     

    Attached Files:

    bluebamf1 likes this.
  3. MousePods

    MousePods

    Joined:
    Jul 19, 2012
    Posts:
    759
    bluebamf1 likes this.
  4. bluebamf1

    bluebamf1

    Joined:
    Jun 2, 2022
    Posts:
    8
    MousePods and Kurt-Dekker like this.