compile errors

I have a group of scripts that compile and run fine under windows and Mac builds. But when I change the project to iOS I suddenly get dozens of compile errors like:
‘HideAllButtons’ is not a member of ‘UnityEngine.Component’

The line of code that it’s erroring out on looks like this:
GetComponent (GUIFunctions).HideAllButtons();
It’s referencing a script that’s attached to a GameController object.

As I said, these same scripts compile and run fine under windows or Mac. Why is it erroring out for iOS?

GetComponent returns an object of class Component, not an object of class GUIFunctions, you need to cast it to be one of it. ( (GetComponent(GUIFunctions) as GUIFunctions).HideAllButtons(); )

Optimally you should always use #pragma strict when working with UnityScript to ensure that it requires basic type safety on all platforms not only on iOS where it gets enforced due to the compile limitations for the platform

Thanks for the help!

Using that format to call the function works perfectly!

Is there a simpler (cleaner) way to call a function in a different script that’s attached to the same object?