- Home /
pragma strict issues with iOS
iOS is killing me. everything works dandily until I tossed #pragma strict at the top of the script to get some things working on the iPad. putting #pragma downcast along with it got rid of nearly 50 errors. right now, i'm wrestling with the following error:
Operator '+' cannot be used with a left hand side of type 'int' and a right hand side of type 'Object'.
this is in response to passing a parameter (the number 5) from another script into the following function:
function SomeFunction(selectedRoll){
pos = currentPos + selectedRoll'
}
so, without pragma strict, 5 is passed as an int. but with it, it becomes an object for some reason. help?
It's passed as Object always if you do it like that, it's just that with dynamic typing, it's cast as int at run-time. That's why dynamic typing is slow.
Answer by Mike 3 · Apr 25, 2011 at 03:01 PM
selectedRoll is untyped in your example above, you should type it as int like such:
function SomeFunction(selectedRoll : int){
Your answer
Follow this Question
Related Questions
Trigger Icicles to drop 1 Answer
How do I check if an object is touching another object? 1 Answer
damage game object 1 Answer
Array - Convert Object into Int 5 Answers
Unity to IPA 1 Answer