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 benhumphreys · Jul 18, 2013 at 05:40 AM · monobehaviournewwarning

"MonoBehaviour with new" warning has no line number

I'm getting the "You are trying to create a MonoBehaviour using the 'new' keyword." error, but it doesn't tell me what file/line this is happening. My project is huge by this point, it could be anywhere.

Edit: I know why the warning is being shown. But the problem is unlike other warnings/errors, Unity doesn't show the class or line number where it's occurring.

We have 10,000+ lines of code and somebody just noticed this. We can look through every line with new or where we've subclassed MonoBehaviour but I was wondering if there was a quicker way.

Does anyone know how to find the source of these warnings?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Riagan · Jul 18, 2013 at 06:21 AM

This might be a repeat... try this link:

http://forum.unity3d.com/threads/119537-You-are-trying-to-create-a-MonoBehaviour-using-the-new-keyword

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 benhumphreys · Jul 18, 2013 at 06:25 AM 0
Share

Thanks for the quick reply. I know why the warning is being shown. But the problem is unlike other warnings/errors, Unity doesn't show the class or line number where it's occurring. We have 10,000+ lines of code and somebody just noticed this. We can look through every instance of "new" or where we've subclassed $$anonymous$$onoBehaviour but I was wondering if there was a quicker way.

avatar image
0

Answer by Jamora · Jul 18, 2013 at 06:35 AM

You should be able to double click on errors/warnings/log messages in the console to open your IDE at the correct line. At least Mono opens the file at the line the message was sent from after double clicking on the console message.

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 benhumphreys · Jul 18, 2013 at 06:41 AM 0
Share

That usually works for me, but nothing happens when I click on this particular type of error message. There is no filename or line number either.

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

18 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

Related Questions

Error trying to createMonoBehaviour using the 'new' keyword in cSharp script 4 Answers

You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. 2 Answers

MonoBehaviours can only be added using AddComponent(). Alternatively. 1 Answer

Unity - UI Dropdown uses constructor for DropDownItem 0 Answers

Unity 2D rotation speeds problem 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