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 Johan 4 · Apr 13, 2011 at 04:03 PM · errorconsole

Override/remove an error from console?

I get this error about object not being destroyed in the editor because it can be done only in game blabla and it's really annoying. Any way to remove it?

Destroy may not be called from edit mode! Use DestroyImmediate instead. Also think twice if you really want to destroy something in edit mode. Since this will destroy objects permanently.

The error if you're wondering.

I don't want to destroy the object in editor anyway, so go away.

Comment
Add comment · Show 3
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 by0log1c · Apr 13, 2011 at 04:13 PM 1
Share

Have you tried actually using DestroyImmediate? Is it running from an editor script? If all you want is to "hide" the error message you can use a try{}catch(error){} block, but then the error still occurs, I wouldn't recommend such a practise. In any case I could use more info about your problem.

avatar image Johan 4 · Apr 13, 2011 at 04:18 PM 0
Share

There isn't more info. The DestroyImmediate will kill it in the editor. I don't want that. I want it to be killed only in game. I do run the script in the editor too because some stuff are needed to run, but this isn't needed.

avatar image Bunny83 · Apr 13, 2011 at 05:20 PM 0
Share

There isn't more info? Your script would be more info. You do something in one of your scripts that we haven't seen yet. Unity warns you that you do something that you should not do. So in the end it's a mistake on your side. Errors don't go away if you ignore them...

1 Reply

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

Answer by Bunny83 · Apr 13, 2011 at 05:17 PM

Sorry, but if you execute code in edit mode YOU have to be sure what you want to execute and what you don't want. I guess you want the script to delete something but only when you're in playmode. So just check that with Application.isPlaying:

[...]
if (Application.isPlaying)
{
    Destroy(someObject)
}
[...]
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

No one has followed this question yet.

Related Questions

Editor Console window message no longer wraps... Help? Please? 1 Answer

BCE0044 unexpected char : 'h'. 1 Answer

Why do I get this error 0 Answers

MissingMethodException: UnityEngine.Debug.DrowRay 1 Answer

Console gives an error "Invalid metadata file found." 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