• 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 pianoguy04 · Feb 13, 2014 at 09:01 PM · playerparticlesystemoncollisionenterplay

Trying to Play my Particle System OnCollisionEnter Script

I think i'm doing something wrong. When I play my game and my player hits the object that has the Particle System Component and rigidbody, the particle system does not play,

var Dust : ParticleSystem;

 function OnCollisionEnter(collision : Collision) 
 {
      {
      Dust = gameObject.GetComponent(ParticleSystem);
      }
          if(gameObject.tag == "Player")
          {
           Dust.Play();
          }
 }
Comment
Add comment · Show 2
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 getyour411 · Feb 13, 2014 at 11:25 PM 0
Share

Try

 Dust.enableEmission = true; 

just before the .Play()

I haven't used Shuriken much but I have one test script setup and that's doing it for me. If that doesn't do it, add a simple debug statement first in the OnCollisionEnter to verify your collision meets the requirements of one.

avatar image pianoguy04 · Feb 20, 2014 at 06:16 PM 0
Share

Thanks that worked

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by boshko · Mar 16, 2015 at 10:21 PM

Maybe someone will need this my script. Its a little bit extended and changed...

 #pragma strict
 
 var Particle : ParticleSystem;
 Particle.enableEmission = false;
 
 function OnTriggerEnter(){
 
     Particle.enableEmission = true;
     Particle.Play();
              
 }
 
 function OnTriggerExit(){
 
     Particle.enableEmission = false;
     Particle.Stop();
              
 }
Comment
Add comment · 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

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

19 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

Related Questions

How to emit particle from a collision? 2 Answers

Character won't play animation 8 Answers

Damage script is screwed up...? what to do? 1 Answer

Player or character select 2 Answers

How to run a script to only 1 player in a multiplayer fps 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges