x


Game not building on Mac iOS but works fine on PC

So I built my game on my PC and I'm ready to start testing it on my ipod touch. So I installed unity iOS on my mac laptop and copied my project folder over. When I try to build for iOS I get errors on things that seem like they should really work just fine like:

'enabled' is not a member of 'UnityEngine.Component'

or

'isKinematic' is not a member of 'UnityEngine.Component'

any one have any idea what could be happening? Thank you!

more ▼

asked Apr 16 '11 at 04:17 AM

Earth-O-Matic gravatar image

Earth-O-Matic
70 9 9 18

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

There's no dynamic typing on iOS. Put "#pragma strict" in all your scripts. There are already many many answers for the question of how to deal with no dynamic typing with GetComponent etc.; should be easy to find with a search.

more ▼

answered Apr 16 '11 at 07:21 AM

Eric5h5 gravatar image

Eric5h5
80.3k 42 132 521

pragrma strict pointed out about 25 errors and I've been slowly going through them and fixing them. I'm new to programing... very much so so its challenging to figure out how to do this stuff without dynamic typing since this is the first I've heard of it.

I only have 2 issues left though and I'll be back on track. So for anyone out there wanting to build for iOS just throw "#pragma strict" at the start of all your scripts as Eric5h5 suggests. It will be a head ache to basically re-teach yourself but its worth it. Thanks Eric5h5, will be more posts from me to help figure out my 2 issues left

Apr 16 '11 at 08:03 PM Earth-O-Matic

Back when Unity iOS was a separate app, it automatically assumed "#pragma strict" for all JS scripts regardless of whether you put it there or not. It would be nice if Unity still did that, though probably the merging of Unity with Unity iOS complicates things.

Apr 16 '11 at 11:32 PM Eric5h5
(comments are locked)
10|3000 characters needed characters left

sometimes some of the normal codes don't work on unity iphone. i saw this back in 1.7 when i was working in an IOS development project. you can adjust the .net support level in player settings. set it to the full support (not subset) and it should works fine.

check the code lines that they have errors and see if casting is done correctly or not. i don't remember weather javascript's casting works on ios or not.

posting some pieces of the code that get error could be helpful to get better answers too.

more ▼

answered Apr 16 '11 at 04:49 AM

Ashkan_gc gravatar image

Ashkan_gc
9.1k 33 56 117

Here is a snip of code form one of the problem scripts that have the enabled not in unityengine.component

if (GUI.Button (position5, plankPhy, style5)) if (Physics.Raycast (ray, hit, 300)) { Instantiate(PhyPlank, hit.point, Quaternion.identity); GetComponent(ClickSpawn).enabled = false; Time.timeScale = .0000001; }

where GetComponent(ClickSpawn).enabled = false; is the problem line this is deactivating a code that allows spawning an object when the mouse clicks

Apr 16 '11 at 05:20 AM Earth-O-Matic

aaaah that look sterrible I'll post as an answer

Apr 16 '11 at 05:20 AM Earth-O-Matic
(comments are locked)
10|3000 characters needed characters left

Here is a snip of code form one of the problem scripts that have the enabled not in unityengine.component

   if (GUI.Button (position5, plankPhy, style5)) 
            if (Physics.Raycast (ray, hit, 300)) { 
                  Instantiate(PhyPlank, hit.point, Quaternion.identity) 
                  GetComponent(ClickSpawn).enabled = false; 
                  Time.timeScale = .0000001; 
} 

where GetComponent(ClickSpawn).enabled = false; is the problem line this is deactivating a code that allows spawning an object when the mouse clicks

more ▼

answered Apr 16 '11 at 05:22 AM

Earth-O-Matic gravatar image

Earth-O-Matic
70 9 9 18

Also this is in JS

Apr 16 '11 at 05:22 AM Earth-O-Matic
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1960
x1949
x660
x337
x118

asked: Apr 16 '11 at 04:17 AM

Seen: 1476 times

Last Updated: Apr 16 '11 at 04:17 AM