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 /
This question was closed Oct 11, 2012 at 09:15 PM by KiraSensei for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by KiraSensei · Sep 27, 2012 at 11:45 PM · compile-error

weird compilation error

Hello ! I'm working on some UI stuff, and I tried to enable/disable a gameobject but I have a very weird error :

!IsActive () && !m_RunInEditMode

And that's it ... Here is the code line :

 if (text1) text1.gameObject.active = false;

This error is not fatal, I still can play the game. I saw some questions like that in google, but nothing is helping. If someone has an idea ...

EDIT : up ! It happens only in runtime... EDIT 2 : I just found a topic telling that activating/deactivating gameobjects in OnGui method is not safe. Is there a solution to avoid that error to appear (I really need to activate/deactivate my gameobjects ...)

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

  • Sort: 
avatar image
0
Best Answer

Answer by KiraSensei · Oct 02, 2012 at 05:22 PM

Actually I found a simple bypass (specific to my case...).

The problem is apparently that activate/deactivate gameobjects in OnGui() method is not safe at all. I don't know why but that's the way it is ... Instead of deactivating it, I Get my text mesh component and write "" in the text and disable all other components. This way it works, no more weird error. If someone else has a better solution, please contact me.

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
avatar image
0

Answer by dvidunis · Sep 30, 2012 at 09:34 PM

if text1 is a boolean (TRUE/FALSE) change it to: if (text1 == TRUE) text1.gameObject.active = false;

else, if it is a string (abc/123), change it to: if (text1 == "") text1.gameObject.active = false;

and if you will post the WHOLE error we can help you more.

Comment
Add comment · Show 2 · 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 KiraSensei · Sep 30, 2012 at 09:37 PM 0
Share

I'll try your proposals. The posted error is the WHOLE error :)

This is actually a problem because it is clearly not understandable :)

avatar image KiraSensei · Oct 01, 2012 at 05:42 PM 0
Share

I added a "!=null" in the if statement (it's a gameobject, not a boolean or a string) and it changed nothing. Anyone else has an idea of the problem ?

Follow this Question

Answers Answers and Comments

10 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

Related Questions

How do I use a toolbar? 1 Answer

compiler errors with the fps tutorial 0 Answers

ArgumentException: The Assembly System.Configuration is referenced by System.Data. But the dll is not allowed to be included or could not be found. 1 Answer

Custom Build step before compilation 1 Answer

Errors are appearing but i don't know how to fix these... 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