Sudden compilation errors

Hello. I don’t understand why my project starts to report several errors when compiling scripts. All these scripts used to compile without errors, no change has been made, and all errors seem to be string operations related. Things like these is what I am getting all over my scripts:

‘Split’ is not a member of ‘Object’.
‘Replace’ is not a member of ‘Object’.
‘Substring’ is not a member of ‘Object’.
‘length’ is not a member of ‘Object’.
‘IndexOf’ is not a member of ‘Object’.

Does anyone have a clue on what is going on?

Thanks

Hello!,

Do you have like a line or two of code where you are getting your error?

that way we can see what’s happening.

A quick thought suggests me that maybe you are porting your project from an old version of unity? :slight_smile:

Sure Juan

Actually, I use the PlayerPrefs.js from the wiki. On that script, lines 93 to 97…

93 for(var element in split ) { 
94         var key_value = element.Split(["="[0]],2); 
95         if(key_value.Length == 2)
96         _cookies[key_value[0].Trim()] = key_value[1]; 
97    }

Line 94 error says that ‘Split’ is not a member of ‘Object’ element. Solved by placing “:String” after the element declaration on line 93.

This seems like those errors when porting to iPhone, but the strange thing is that I am not porting to iPhone and I did not updated Unity to a newer version. All these errors appeared suddenly when I was running it fine.

I solved them by attacking one by one. But I don’t know what caused the problem.

I am guessing it is do to “var element” not having a type explicitly assigned to it.

Try “var element : String”

Thanks careyagimon. That is the solution to one of the errors, and it was mentioned before. The real problem is the sudden appearance of several string related errors all around the project. Errors not identified before.