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 edy_sefu41 · Mar 14, 2018 at 03:21 PM · scripting problemwontwork

Death Particles won't show where player dies.,Particles won't follow the player.

,So I'm working on a 2D platformer, and I got stuck somewhere. I have set up a particle system, one that will show when the player dies and one that will show when the player respawn, the script is EXACTLY as the one in the tutorial that I'm following: https://youtu.be/vwUahWrY9Jg?t=9m42s But my particles won't show on the player when he dies. They will be shown on the default spot that they were created. Like this: http://recordit.co/4C13Wk37uM I already deleted them from there, and I think that the death particle should be attached to the player or something so it can follow the player and play when he dies. And the respawn particle should be attached to the checkpoints. In the video the guy does nothing about that but they work. Any help? Please, I've been struggling on this for a couple of hours and it's already frustrating

The script:

using System.Collections; using UnityEngine;

public class LevelManager : MonoBehaviour {

 public GameObject currentCheckpoint;

 private PlayerController player;

 public GameObject deathParticle;
 public GameObject respawnParticle;

 // Use this for initialization
 void Start () {
     player = FindObjectOfType<PlayerController>();
 }
 
 // Update is called once per frame
 void Update () {
 }

 public void RespawnPlayer()
 {
     Instantiate (deathParticle, player.transform.position, player.transform.rotation);
     Debug.Log ("Player Respawn");
     player.transform.position = currentCheckpoint.transform.position;
     Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation);
 }

}

Please help me

Comment
Add comment · Show 1
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 RustyCrow · Mar 14, 2018 at 06:48 PM 0
Share

The thing is you can attach the script to whatever Game object in the scene and it should work. Lets try to troubleshoot 1. Did you make a Prefab of the Deathparticle. 2. Did you drag and drop the Deathparticle prefab on to the Level manager script in the inspector? 3. Dose the script find the player game object(you are not getting Null errors right ?)

You mention " I think that the death particle should be attached to the player or something so it can follow the player and play when he dies" the code dose this for you, Follow the tutorial 100%. If you are still having problems you just got to reset man.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by CoderNation1 · Mar 15, 2018 at 03:10 AM

The reason why you don't see your death particles is that once you die you instantly get reset back to your checkpoint. Basically teleporting. You never get the chance to see the actual particles because the dying and respawning all happens in an instant. I recommend you use a Coroutine so you can see the death particles momentarily then you reset the player. Call the Respawn function all happens in a single cycle with no delay. @edy_sefu41

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

137 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

Related Questions

Multiple coroutines starting from Update() freeze/crash Unity 0 Answers

UI Buttons to work continuously when pressed and held for sometime 1 Answer

variable from another script doesn't update 0 Answers

Jumping in 3D 1 Answer

How do I change the camera automatically after a set timer? 1 Answer


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