Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Dreatix · Jun 28, 2012 at 08:44 AM · particlesdead

Death with particle effect.Still need Help!

Hi guys,im making roll the ball game,anyway when my ball falls off from level,it gets destroyed,or when im hiting some obstacles it gets destroyed too.Well I want to make it better,i want particle effect plays when i get destroyed-(''Dead''),(particle effect plays just some seconds when i get destroyed). Please help me at this.Thanks for attention :)

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

5 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by FLASHDENMARK · Jun 28, 2012 at 09:01 AM

Use the Instantiate command, when the ball gets destroyed.

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
avatar image
0

Answer by Tim-Michels · Jun 28, 2012 at 09:14 AM

You add a ParticleEffect to your scene, but you disable emitting. (particleEmitter.emit = false;)

Now, when you want the particle to show, you simple set particleEmitter.emit = true; If the particle needs to follow your ball, you could add the particle as a child of the player. That way the effect will always follow your player.

Also experiment with the simulation space. If you want your particles to actually animate in world space, you will need to set it that way.

If the simulation space of the particle is set to local, and your ball moves while emitting, the particle will not emit in a realistic way because it is moved.

Experiment with this stuff and you can create some really cool effects for your ballgame.

Cheers ;)

Comment
Add comment · Show 3 · 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 Dreatix · Jun 28, 2012 at 09:28 AM 0
Share

particleEmitter.emit = true; on Death? it is only enabling particle effect,but how to add it? I dont understand.

avatar image Tim-Michels · Jun 28, 2012 at 10:12 AM 0
Share

Well, if you don't have a particle-effect in your scene, you will need to Instantiate a particle prefab.

Here's a small example: (C#)

public GameObject ExplosionPrefab;

void OnDeath()

{

 GameObject explosion = Instantiate(ExplosionPrefab) as GameObject;

 explosion.particleEmitter.emit = true;

}

The public gameobject 'ExplosionPrefab' should be assigned in your scene with a self-made particle prefab, or one of the Unity standard particles.

Instantiate essentially creates a new instance of something you want to create at runtime.

avatar image Dreatix · Jun 28, 2012 at 04:07 PM 0
Share

I posted my script up there

avatar image
0

Answer by Dreatix · Jun 28, 2012 at 03:53 PM

Here is my Death script:

 public void Death()
 {
     audio.clip = DestroySound;
     audio.Play();
     Time.timeScale = 0f;
     death = true;
 }

}

An there is second death script:

 if (other.tag == "Destroy")
 {
      _GameManager.GetComponent<GameManager>().Death();
      Destroy(gameObject);
 }


I Dont know how to modify it like as your example,so can you please help me to do this? Pay attention on time scale,i want that time scale dont affect the particle effect,but i also want it Of.

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
avatar image
0

Answer by NoizTank · May 07, 2015 at 06:26 AM

Hey guys, I'm still relatively new to C# and Unity as a whole, but I'm making a simple 2D game and I solved the problem of death effects by adding an empty game object into my scene called DeathEffect, then creating a prefab of it. I then attached this code to my player:

 public GameObject deathEffect;
 
 
 
     void OnCollisionEnter2D(Collision2D col){
         if (col.gameObject.name == "FlyingSquid") {
             Instantiate (deathEffect, col.gameObject.transform.position, col.gameObject.transform.rotation);
             Destroy (col.gameObject);
         }
     
     }

Then I just stuck my DeathEffect object into the public GameObject deathEffect slot on my script component. I hope this noob knowledge helps someone:)

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
avatar image
0

Answer by guinoalaskapp · Jun 08, 2021 at 03:11 AM

No no no, I have the same problem, but I need to:

1: disable my 2d sprite renderer 2: play the particle effect 3: wait until particles gone 4: reset players position and also entire map "running" stuff

All of those things i can do, my isue is:

1: it dont disable the sprite renderer 2: it plays the particke effect to late 3: it never wait, it restart instantly dies and then display particles 4: it restet the player position, but again, instantly

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.

Follow this Question

Answers Answers and Comments

8 People are following this question.

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

Related Questions

Multiple Cars not working 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

c# play particle effect on key press? 1 Answer

Weird GUILayout Scrollview Behavior 0 Answers

hide object start script 4 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