- Home /
iOS / dynamic typing issue: not a member of 'UnityEngine.Component'
I know my problem has to do with dynamic typing not being supported in iOS but am still having trouble fixing this specific issue. I'm getting the following error for the following code snippet when I try to build for iOS. Note I'm combining javascript and C# code:
Error: Assets/Plugins/ElectronMouseAction.js(139,46): BCE0019: 'RS_config' is not a member of 'UnityEngine.Component'.
Code snippet from ElectronMouseAction.js:
#pragma strict
<other stuff>
var rsc : GameObject;
function FakeOnMouseDown(){
rsc = SGC.GetComponent("LineReader").RS_config;
<other stuff>
}
The component it's referencing is from a C# script LineReader.cs:
public class LineReader : MonoBehaviour{
public static int RS_config = 0;
<other stuff>
}
Does anyone have any clues how I can make this behave? Thank you!
Answer by dannyskim · Feb 08, 2012 at 08:13 PM
RS_config is declared as an integer. You are trying to set rsc, which is a Game Object, to a value of an integer. Therefor, RS_config is an integer, which is a member of System, not the UnityEngine. And vice versa, a Game Object is a member of UnityEngine, not System.
Answer by amherst · Feb 08, 2012 at 10:05 PM
Oy, sorry, that was a typo in the copied over code. My code is actually:
ElectronMouseAction.js.:
#pragma strict
<other stuff>
var rsc : int;
function FakeOnMouseDown(){
rsc = SGC.GetComponent("LineReader").RS_config;
<other stuff>
}
The component it's referencing is from a C# script LineReader.cs:
public class LineReader : MonoBehaviour{
public static int RS_config = 0;
<other stuff>
}
Did you ever find an answer to your question? I have a similar issue...