Author Topic: Bugs  (Read 4490 times)

sebas

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Bugs
« on: May 23, 2012, 06:16:46 AM »
I finally tracked down two bugs in my project that seem to be related to NGUI code.
With a very simple setup with a Camera a Panel and some Sprites I get:

Several "CompareBaseObjects  can only be called from the main thread." messages with the following extra info:
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.

and "Scene is being destroyed while there are hidden renderers that are using it. This is likely an editor script creating objects with hideFlags and leaving them enabled."

when I stop the execution.

Edit: using 2.0.7
The first problem seems more serious. Thank you for your attention.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Bugs
« Reply #1 on: May 23, 2012, 08:09:12 AM »
We had a similar problem like the last, when we triggered a gameoverscreen on a physics collision (OnTriggerEnter, I believe) and removed the ingame screen. We just ended up waiting for Update to trigger it instead as a solution.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Bugs
« Reply #2 on: May 23, 2012, 08:22:23 AM »
The first issue is with you trying to do too much from outside the main thread. Look closely at what you're doing. Without code showing what you're doing I can't tell you any more than that.

Second issue I've seen happen in the space game kit a while back I think. I don't remember ever seeing it in NGUI. Again, code / examples is key when it comes to explaining what you're doing wrong, and without any I can't do much.

sebas

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: Bugs
« Reply #3 on: May 23, 2012, 08:45:38 AM »
it could be, but there are 2 things to take in account.

I do not use multithread
The current setup uses only NGUI classes with no custom code (it is a testing scene)

Edit: I will ask if I can share the project
« Last Edit: May 23, 2012, 08:47:16 AM by sebas »

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Bugs
« Reply #4 on: May 23, 2012, 09:39:37 AM »
Our issue was that NGUI called DestroyImmediate from a physics call, which is a no go. So the sprite sorta just broke, until we restarted unity after that and made the second error.

sebas

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: Bugs
« Reply #5 on: May 23, 2012, 09:56:02 AM »
Ok I need to put this investigation on hold until the begin of the next sprint, since I noticed we actually changed some NGUI files, so I cannot prove it is NGUI itself. I will ask to revert those files to the original ones and test again.

sebas

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: Bugs
« Reply #6 on: May 23, 2012, 10:58:51 AM »
Apologize, it looks like the problem was related to the use of a destructor in one class completed unrelated to NGUI. Craaazy.
The bare scene was not working because I was using a GameObject created from a Prefab. Even though the new GameObject was reduced to the bare minimum, it was still importing the original prefab code. This is something incredible I need to check with the Unity Devs.