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 /
  • Help Room /
avatar image
3
Question by Blue Astronaut · Mar 09, 2014 at 09:03 PM · c#particlesenemy healthhealth

How to make a particle effect do damage?

Hi! I was wondering if there is a way to make a particle effect do damage? Like, when a enemy/player enters the particle effect, it will slowly do damage. My particle effect looks like this: alt text

So now the question is, how would I achieve the fire damage? I wrote a extremely basic health script to attach to a cube, so when its health reaches 0, it gets destroyed:

 using UnityEngine;
 using System.Collections;
 
 public class AI_basichealth : MonoBehaviour {
     public float HealthLevel = 100.0f;
     public GameObject EnemyObject;
     // Use this for initialization
     void Start () 
     {
         if(HealthLevel >= 0)
         {
             EnemyObject.SetActive(false);
         }
     }
     
     // Update is called once per frame
     void Update () {
     
     }
 }


Would I achieve this using particle collision or, what? I don't want a script written for me, but a nudge in the right direction would be greatly appreciated! :D

Thank you so much in advance! - Nikolai

particleexample.png (479.9 kB)
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

3 Replies

· Add your reply
  • Sort: 
avatar image
5
Best Answer

Answer by Owen-Reynolds · Mar 09, 2014 at 09:12 PM

The usual method is -- don't make particles do damage. The particles are just decoration. It's a very old game trick, and you can see in many games where damageArea isn't quite particle area.

Instead, put an invisible collider/trigger in the area, and have it do the damage. Lots of examples of that here.

Comment
Add comment · Show 1 · 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 Blue Astronaut · Mar 09, 2014 at 09:20 PM 0
Share

Oh ok, thanks!

avatar image
2

Answer by N47 · Dec 20, 2019 at 04:15 PM

https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnParticleCollision.html

This might help also.

Comment
Add comment · Show 1 · 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 Owen-Reynolds · Dec 20, 2019 at 05:28 PM 1
Share

Checking for particle collisions is new since the answer about adding a trigger, but I still think a trigger is better for damage effects. Particles can randomly go where-ever, and you might make lots of small ones, or fewer big ones for an equally "hot" flame area. The number of particle hits won't be consistent. A sphere trigger is, and is easier to resize, and probably runs faster.

avatar image
1

Answer by suIly · Nov 09, 2019 at 07:24 PM

You can set the particle collision by going to the particle system object, setting a tag like "Fireball" for it, and scrolling down to Collision, check it and set it to world. This should work.

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

24 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

Related Questions

How to make my gun do damge and destroy a object? 1 Answer

Draining Particle Effect? 0 Answers

Changing particle data upon collision. 1 Answer

How to Instantiate decals where particles from particle system hits? 1 Answer

No Particle Rotation When Setting rotation3D from C# 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