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 Louis-N-D · Sep 04, 2014 at 09:19 AM · particleseffects

Behaviour of SetActive seems to have changed. Re-firing effects now interrupts itself, breaks my effect system.

Ok, first let me define what I mean by effects. For my purposes, an effect is a gameObject which is the parent of other objects, usually some particle emitters and an audio source.

I built an effect system that instantiates one instance of each effect I will need from a public array of GameObjects at level start (in the Awake() function). In gameplay, I simply make a calls to my effect manager to move the desired effect to the desired location and "fire" it, giving me sound and particles as desired.. well.. until today. Since today, firing an effect again, causes any remaining particles to disappear before the effect fires again. The old behaviour used to be that particles that had already been emitted would stick around to their death unless I failed to allocate enough particles to the effect.

Please note that I have NOT touched this code at all in MONTHS. The only thing that has happened between these two builds was upgrading from 4.5.2 to 4.5.3. However, I'm pretty sure I built the version that's currently on my iPod using 4.5.3 and it does NOT show the new issue. Also, I've been using 4.5.3 since its release but have only now noticed the problem.

Here is what the code that "fires" the effects looks like: (note:I set the object to inactive then active on the same frame to achieve this)

 public function PlayEffectAtLocation(effectName : String, effectPosition : Vector3, effectRotation : Quaternion)
 {    
     var i : int = effectsDictionary[effectName];
 
     effects[i].transform.position = effectPosition; //set effect position
     effects[i].transform.rotation = effectRotation; //set effect rotation
     effects[i].gameObject.SetActive(false); //ensure effect is inactive
     effects[i].gameObject.SetActive(true); //activate effect
 }


[1]: http://www.northernbytes.ca/unity/Top_Down_Platformer_OLD/Top_Down_Platformer.html

[2]: http://www.northernbytes.ca/unity/Top_Down_Platformer/Top_Down_Platformer.html

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

1 Reply

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

Answer by MrXee · Sep 04, 2014 at 05:24 PM

This v4.5.3 release note probably has something to do with your issue:

Shuriken: Fix for re-enabled particle system which was disabled before it has finished.

My suggestion would be to do a gameObject.GetComponent.Play() instead of relying on the playOnAwake flag.

If you have multiple particle systems you can always iterate through them using something like this:

 foreach( var ps in gameObject.GetComponentsInChildren<ParticleSystem>() )
   ps.Play();
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 Louis-N-D · Sep 04, 2014 at 05:59 PM 0
Share

So, I get that. The fact my technique worked at all always felt like a bit of a lucky break... Is there a simple way that I could get all objects under the parent to all act like they've all just become active again regardless of the type of object or components on them?

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to get Zerg Tentacle-like effect (see example in post)? 1 Answer

How do you make a particle effect always emit upwards? 2 Answers

Get Particles to Travel in a Line 1 Answer

Water Splash Screen Effect on Camera 0 Answers

How do I get particles to emit on collision? 2 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