0

I have created a new Xcode Project and added "Data", "Classes" & "Libraries" folder from the Xcode project generated by unity.Now AppController.mm is causing error.Below is the code where error is:

(surface->eaglLayer) = (CAEAGLLayer*)[view layer];

and Here is the error line: Assigning to " void * " from incompatible type " CAEAGLLayer * "

onof
  • 17,167
  • 7
  • 49
  • 85
Hawk-Eye
  • 400
  • 1
  • 7
  • 23
  • I think its supposed to be other way around. Te error says it clearly. Try `(surface->eaglLayer) = (void*)[view layer];` – Majster Jan 25 '13 at 08:22
  • What version of Unity do you use? Did you modify `AppController.mm` (I can't find this line in 3.5.6)? `surface->eaglLayer` is in fact of type `void*` as Majster said. – Kay Jan 25 '13 at 10:58
  • @Kay I m using unity 4.0.0f7 and No, i haven't modified 'AppController.mm'. – Hawk-Eye Jan 28 '13 at 06:33

1 Answers1

1

When you export a Unity project to Xcode, Unity generated all needed thing for you, including adding all necessary frameworks and libraries, adding files should be compiled, setting up project file and some other things. When you create your new project in Xcode, and copy/paste the three folders to it, all of the things above are NOT get set. So you will have a lot of trouble in handling them. In your example, CAEAGLLayer is something related to OpenGL, and you should add OpenGLES.framework at least.

The conclusion is: DO NOT create project and copy/paste as that except you exactly know what you are doing. Otherwise it's not likely to make the project building and linking successfully. Always use the project Unity exported and modify things on it.

onevcat
  • 4,591
  • 1
  • 25
  • 31
  • I want to use unity application as a little part in my iphone app.And my app is ARC compliant but project created by unity is Non-ARC.How can i make the whole app ARC compliant? – Hawk-Eye Jan 28 '13 at 06:44
  • 1
    I think it's better not to convert unity project to ARC, but just set no-arc flag for them. Try to add -fno-objc-arc compiler flag to all files exported by Unity. If you don't no where to add the flag, see [this question](http://stackoverflow.com/questions/6646052/how-can-i-disable-arc-for-a-single-file-in-a-project) – onevcat Jan 29 '13 at 00:31