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 Lboy · Jul 11, 2012 at 04:30 PM · c#particlesemitter

turning on a particle with an input key

hey there, i have this code on my waterfall, i need to turn it on with my input key "o" but when i test it out it says

The object of type 'ParticleEmitter' has been destroyed but you are still trying to access it.

Your script should either check if it is null or you should not destroy the object. heres my code using UnityEngine; using System.Collections;
public class sensorwaterfall : MonoBehaviour {
public ParticleEmitter myBigmist = null; public ParticleEmitter myBigfoam = null; public ParticleEmitter myBigsplash = null;
// Use this for initialization void Start () { myBigmist.emit = false ; myBigfoam.emit = false ; myBigsplash.emit = false ; }
// Update is called once per frame void Update () { if (Input.GetKeyDown("o")){ myBigmist.emit = true ; myBigfoam.emit = true ; myBigsplash.emit = true ;
}
} } i have manually dragged the components to the = null in my inspector thanks ![alt text][1] ![alt text][2] [1]: /storage/temp/1816-emitter+1.jpg [2]: /storage/temp/1817-emitter+2.jpg
emitter 1.jpg (53.6 kB)
emitter 2.jpg (55.5 kB)
Comment
Add comment · Show 7
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 flamy · Jul 11, 2012 at 05:10 PM 0
Share

hmm what are you attaching in inspector, prefab or a gameobject from scene?!

avatar image TheDarkVoid · Jul 11, 2012 at 05:13 PM 0
Share

is there something that destroys your particle emitter, because according to the error the particle emitter was there but was destroyed.

avatar image Lboy · Jul 11, 2012 at 05:23 PM 0
Share

@Flamy; im attaching a particle prefab from the scene

@TheDarkVoid; this is the issue, I havent destroyed it, im simply trying to say, untill "o" is pressed, the emitters should be false, when "o" is pressed, the emitters should be true

avatar image flamy · Jul 11, 2012 at 05:29 PM 0
Share

im not getting again... is it in scene or project? if it is in project what ever you are trying wont work..

The code is perfect. Just make sure that the prefab is in the scene not just in the project.

avatar image Lboy · Jul 11, 2012 at 05:39 PM 0
Share

here is a screen of what I have set up, the prefab is a waterfall prefab with the emitters within it. alt text

alt text

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

All instances of particle emitter prefab are emitting when emit=true 0 Answers

ParticleSystem.Play() does not play particle. 10 Answers

Application.LoadLevel and particle system 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