Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 karma0413 · Mar 06 at 04:39 AM · particlesparticle system

How do I spawn a sub-emitter without using burst?

PROBLEM:
I tried to use the sub-emitter module in particle system, but the only way to activate it is via the "burst" emission setting on the actual sub-emitting-particle-system.

This was very terrible for my use!

I have a flamethrower, and each particle that touches the ground needs to spawn a fire! But, using burst mode doesn't allow the "fire" to propagate in the correct way. What I need is a way to Instantiate(fire) when the particle collides with the ground.

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

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

Answer by karma0413 · Mar 06 at 05:10 AM

THE ANSWER: There are many many complicated work-arounds and hacks online. After many hours of research into the topic, it appears that inside the particle system is the module: Triggers.

Inside of that module, You can clearly see that you can have the ability to interact with colliders set in the LIST.

The Downside is, that you have define which trigger colliders you want to interact with. Right, now, I just click the (+) and added the Terrain. Although, I am sure later, you might want to add a script which can automatically define all the different colliders you might have which we can collectively call "The World"

In my setup, this "FlameThrower" particle prefab will be instantiated when the player press the correct button. Because I don't want a bunch of prefab references I also added the "Particle-GroundFire" as a child, but I disabled it. --->Picture Attached
alt text

FIRST, we will adjust the Trigger module on the main particle system (In my case that is named "Particle-Flame". So, after updating the LIST of colliders go down and set the Enter Trigger to "Callback".
alt text

NEXT, I make sure this particular spell thingie, has a layer called "Spell-ToWorldOnly", and then edit the project settings so that the physics truly only interacts between this spell-toWorldOnly and World (of which terrain is part of it).
NEXT, The when/what/why/how comes next! We will add trigger-script to the "Particle-Flame" which collides with my world, so that it know how to instantiate the object. The "when" is defined in the above mentioned trigger module of the main particle system.

Again, you can see now why I made the sub-emitter called "Particle-Groundfire" initially disabled. Because, I just want to drag it into the script inside of the editor window without referencing an additional prefab.

CREDIT must be given to the original Unity manual listed here as reference:
Unity Manual: Particle Systems Trigger Module

Here is my slightly modified script which is attached to the main particle system called: "Particle-Flame"

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class ParticleTrigger : MonoBehaviour
 {
 
     public GameObject groundFire;
     private ParticleSystem ps;
     private List<ParticleSystem.Particle> enter = new List<ParticleSystem.Particle>();
     
     void OnEnable()
     {
         ps = GetComponent<ParticleSystem>();
         
     }
 
     void OnParticleTrigger()
     {
         // CODE WILL ALWAYS BE RUNNING CHECKING FOR TRIGGERS
         int numEnter = ps.GetTriggerParticles(ParticleSystemTriggerEventType.Enter, enter);
         
         
 
         // iterate
         
         for (int i = 0; i < numEnter; i++)
         {
             ParticleSystem.Particle p = enter[i];
             GoInstantiate(p.position);
             p.startColor = new Color32(255, 0, 0, 255);
             enter[i] = p;
         }
         
     }
 
     void GoInstantiate(Vector3 position)
     {
         GameObject tempObj = Instantiate(groundFire);
         tempObj.SetActive(true);
         tempObj.transform.SetParent(this.transform);
         tempObj.transform.localPosition = position;
     }
 }
 
 



flame-thrower.jpg (11.1 kB)
triggers.jpg (35.9 kB)
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 j1mmie · May 12 at 09:05 PM

An easier approach that worked for me was to create a Sub-Emitter within a Sub-Emitter.

In my case, I am creating a particle effect for lasers being fired. When the lasers hit their target (i.e. die), they create a bullet hole. While the bullet hole exists, it emits a smoke effect. In the hierarchy, it looks like this:

 LaserEmitter
     HoleEmitter
         SmokeEmitter

LaserEmitter has the Sub-Emitters section enabled, with HoleEmitter added on Death HoleEmitter has the Sub-Emitters section enabled, with SmokeEmitter added on Birth

If you don't need to render a middle Sub-Emitter (Hole), you can turn off its Renderer section.

Make sure the lifetime of the middle Sub-Emitter (Hole) is equal-or-greater-than the lifetime of the bottom Sub-Emitter (smoke)

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

140 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

Related Questions

Particle System - How can I make sure top parent end last? 1 Answer

Flip Particle System Graph 0 Answers

Break 3D Object into Pieces 2 Answers

ParticleSystem TriggerModule: Collide with world / collide with unlimited colliders? 0 Answers

Auto-destroying particle system 11 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