|
I want to build a project using iOS in the unity The project I created runs normal in play mode. But when it comes to be built in Unity Builder it shows up errors like this
The question is why this happens? I run the project in the play mode and nothing goes wrong... someone help me please...thx :)
(comments are locked)
|
|
Hi, when you run an app on IOS it uses pragma strict. So you can not use most shortcuts. if you add: to the begging of your code, you will get the same errors in the editor. this will help you avoid the problems. for example, you can use in the editor. but with strict on, this would give you an error like "enable is not a member of Component" so you would have to use: That won't solve the problem. If you declare TheMesh as a MeshRenderer GetComponent(MeshRenderer) will still return a Component, not a MeshRenderer and you'll get "Cannot convert 'UnityEngine.Component' to 'UnityEngine.MeshRenderer'." there's also no need to spread this out over two lines. What you need to do is
Jun 24 '11 at 12:22 PM
Joshua
I've got similar issue, that is - build for web is fine, build for iOS couses similar errors. For example: sceneManager.transform.GetComponent("scriptSceneManager").SubstractLife(); How do solve this problem?
Jun 24 '11 at 12:39 PM
michalbigplay
Look at the comment right above yours. SubstractLife is not a member of Component, so you must cast it as SubstractLife.
Jun 24 '11 at 01:42 PM
Joshua
Joshua, it doesn't need to be so verbose. is fine. I mean, it has a typo and uses camelCase where PascalCase would be standard, but it should compile.
Jun 24 '11 at 02:29 PM
Jessy
(comments are locked)
|

pragma strict really helps :)
the problem is solved....I just type cast the component I want to show :) thx