• 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
Question by Lboy · Jun 07, 2012 at 04:47 AM · errorerror messagemissingreferenceexceptionparticleemitter

Particle Emitter error, Missing reference exception.

Hi, I have a this error constantly popping up.

MissingReferenceException: 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.

I have this script on my waterfall, the tag "EditorOnly" is a rock object (with a mesh collider) designed to stop the waterfall from flowing when it conjuction with the waterfalls collider. All the publicemitters are assigned in the inspector. thanks.

 using UnityEngine;

using System.Collections;

public class Waterfalltrigger2 : MonoBehaviour {

public ParticleEmitter myBigmist = null;
public ParticleEmitter myEmitter = null; public ParticleEmitter myWatersplash = null;
public Light Waterpointlight = null;

void OnTriggerEnter(Collider other){ if(other.CompareTag("EditorOnly")) myEmitter.emit = false ; myWatersplash.emit = false ; myBigmist.emit = false ; Waterpointlight.intensity = 0 ; }

void OnTriggerExit(Collider other){ if(other.CompareTag("EditorOnly")) myEmitter.emit = true ; myWatersplash.emit = true ; myBigmist.emit = true ; Waterpointlight.intensity = 2 ; } }

Comment

People who like this

0 Show 2
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 hijinxbassist · Jun 07, 2012 at 05:24 AM 1
Share

Remove the =null part of the declarations.

avatar image Lboy · Jun 07, 2012 at 07:38 AM 0
Share

thanks hijinx

1 Reply

  • Sort: 
avatar image
Best Answer

Answer by rutter · Jun 07, 2012 at 07:16 AM

I would try hijinxbassist's suggestion.

If that doesn't work, make sure that you've set the references up in the inspector. If any of them are listed as "None", they're not pointing at anything.

Finally, you might want to check if the ParticleEmitter has AutoDestruct set -- if so, it will self-destroy once the emitter has finished. After that happens, subsequent attempts to access to emitter can produce errors.

If push comes to shove, you could always check for null before using the reference. It might allow you to figure out exactly when things are going wrong, if you log a message once that happens.

Comment

People who like this

0 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 Lboy · Jun 07, 2012 at 07:37 AM 0
Share

i tried hijinx's method, didnt work but then i turned off the automatic emit on the waterfall and it worked for some reason. i did leave =null out by the way

thanks for the help guys.

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Error opening project.,Error opening project 0 Answers

Why is this happening to my editor? 1 Answer

Cannot Import TextMeshPro Essentials 0 Answers

Assets\PlayerController.cs(29,29): error CS0200: Property or indexer 'Vector3.normalized' cannot be assigned to -- it is read only 1 Answer

movement not working,movement controller not working 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