Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
This question was closed Aug 12, 2017 at 03:10 PM by vardevelopment for the following reason:

Problem is not reproducible or outdated

avatar image
0
Question by vardevelopment · Jul 25, 2017 at 12:35 AM · errorconsole

How to disable an error because it is intentional

I am selecting Transforms within a script by raycasting and when the selection finishes I set the Transform to null. The issue is that that the console is getting polluted with the same error message every frame saying that the Transform is not set to an object. Because of this, I can't see any of my actual errors because they are all hidden in the console. Is there any way to make Unity stop logging the specific error on purpose?

Comment
Add comment · Show 1
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 bobisgod234 · Jul 25, 2017 at 02:20 AM 0
Share

Setting the transform to null may be intentional, but trying to access a nonexistent transform can't be (what is your intent behind this?). This is an "actual" error that needs fixing, not ignoring.

2 Replies

  • Sort: 
avatar image
1
Best Answer

Answer by Brogan89 · Jul 25, 2017 at 02:37 AM

what you should do is add a conditional to all the places you are using that transform.

if(transform != null) // ... do stuff

Because what is happening is, something is trying to access that reference but it's null, so Unity throws an exception (error) because this should never happen.

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 vardevelopment · Jul 30, 2017 at 08:08 PM 0
Share

That makes sense. I never got around to optimizing my scripts because I have been trying to get very many completed. I now went and changed that. Thank you :)

avatar image
0

Answer by toddisarockstar · Jul 25, 2017 at 12:58 AM

you really can't have errors. there should be no red. errors can make you code do other weird thinks like skip lines and stuff. I would think there must be a way to accomplish your code so this is not a problem. but if you have to you can use a "try" and "catch" statement in C#. To handle an error.

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/try-catch

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

Follow this Question

Answers Answers and Comments

90 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

Related Questions

The console no longer takes you directly to the error in the script? 1 Answer

Console Error 1 Answer

How do i fix the compiler error in the plat former 2d user control in the console to enter play mode? 0 Answers

InputField add text 'StackOverflowException' error 1 Answer

Console error with animation 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