Author Topic: Android UILabel problem  (Read 2340 times)

Tom1989

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Android UILabel problem
« on: February 18, 2014, 08:25:29 AM »
Hi,

I am using unity 4.3.0, building an android project.

I am pulling data down from parse.com and initialising a couple of labels throughout the project with the data. I am however getting this error when i try UILabel.text = string

"CompareBaseObjectsInternal can only be called from the main thread.
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."

However...this is working absolutely perfectly on the WebPlayer version of my project?

Any help would be massively appreciated.

Tom1989

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Android UILabel problem
« Reply #1 on: February 18, 2014, 08:47:13 AM »
Fixed the problem.

If anyone is having the same problem it was due to me calling an initialise function from within a lambda expression so as the error message said, i was calling things from outside the main thread.

So to fix this i started a coroutine after the lambda which is waiting for a magic boolean to be set to true from within the lambda.

Problem Solved