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 /
This question was closed Apr 25, 2018 at 11:51 PM by S_jay1 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by S_jay1 · Jan 03, 2018 at 09:01 PM · animationanimatorparticles

How do I use a particle system?

I want to call upon the particle system when my player dies as an animation, but I don't know how to do this. It is giving me this error "The type or namespace name 'Play' does not exist in the namespace 'System' (are you missing an assembly reference?)." I want to be able to have the animation/particle system play when the player dies, how do I make that happen?

This is my code so far:

 using System.Collections;

using System.Collections.Generic; using UnityEngine;

public class DestroyContact : MonoBehaviour {

 PlayerController playerMovement;
 ParticleSystem animate;
 public bool dead;

 void Awake()

 {

     playerMovement = GetComponent <PlayerController> ();
     animate = GetComponent <ParticleSystem> (); 
 }
 void Update(){
     
 }

     
 void OnTriggerEnter (Collider other)
 {
     if(other.gameObject.tag == "Floor")
     {
         return;
     }
     if(other.gameObject.tag == "Collider");
     Destroy(gameObject);
     PlayerDead ();
         
 }    


 void PlayerDead()

 {
     
     dead = true;
     playerMovement.enabled = false;
     System.Play(animate);  //this is where it is giving me the error

 }

}

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

2 Replies

  • Sort: 
avatar image
1
Best Answer

Answer by OneCept-Games · Jan 03, 2018 at 09:06 PM

First of all, ParticleSystem is not an Animation, so your naming might confuse you later.
Next, try to start the ParticleSystem by:
animate.Play(true);

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 S_jay1 · Jan 04, 2018 at 05:22 PM

I changed it to particleSystemPlayer.Play(true); after changing the name from animate to particleSystemPlayer. The error is now gone but how would I make the particle system to play at the position in which the player died at?

Comment
Add comment · Show 2 · 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 OneCept-Games · Jan 04, 2018 at 09:43 PM 0
Share

You would position the particleSystemPlayer at the same position before starting it:
In your case: particleSystemPlayer.transform.position = player.transform.position;

avatar image S_jay1 OneCept-Games · Jan 05, 2018 at 04:37 PM 0
Share

I set the position of the system to the position of the player and then set it to play and it works perfectly. Thank you so much!

Follow this Question

Answers Answers and Comments

194 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 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

How can I play an explosion animation? 3 Answers

2D Animation does not start 1 Answer

2D Particle System but using Frame by Frame Animation? 0 Answers

Coins animations maybe with particles 1 Answer

Damn, HOW CAN I KNOW, IF MY 2d ANIMATION SPRITE IS FINISHED??!! 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