Hi,
When i try to access a variable or a function which i have declare in a script from another script, it gives an error “…is not a member of Unity.Component”. How can i remove this error? I know this is a case of dynamic casting but dont know the solution to this.
Thanks
I am only guessing her but…
“dynamic typing in JavaScript is always turned off in Unity Android”
Just an example but, you have to define the variable whereas in Unity stand alone you wouldn’t need the extra scoreKeeper
var yourScript : scoreKeeper = target.GetComponent (scoreKeeper);
in order to do something like:
if (badGuyIsMad){
yourScript.scoreSomePoints();
}
Again I’m only guessing without a specific example but that is one of the more common erros when trying to convert a unity project to droid or iOS
taking u r example, when i try to declare a variable scoreKeeper, i get an error saying the type is not defined or something like it basically saying that no such type exist.
This error is flaged
Assets/Standard Assets/Scripts/General Scripts/GameData.js(24,14): BCE0018: The name ‘scriptBlock’ does not denote a valid type (‘not found’). Did you mean ‘UnityEditor.ScriptCallOptimizationLevel’?
for this statement,
var myScript:scriptBlock;
For the example I used, the target would need to be defined too since that is the actual object that has your script
var target : GameObject;
If you just tried to use the my example it wouldn’t know what object had the script.
Sorry for the confusion, I took your example just for reference here. I have a “block” gameobject with a script “scriptBlock” attached to it. when i call,
block.GetComponent(“scriptBlock”).MyownFunction(); i get the error “…is not a member of Unity.Component”. and if i decl a var,
var myScript:scriptBlock;
then i get “The name ‘scriptBlock’ does not denote a valid type (‘not found’)” error.
well, (‘not found’) means it doesn´t find the script ‘scriptBlock’ 
check spelling and capitalization.
There is no spelling mistake because i copied the scriptBlock from the GetComponent statement and pasted it in the declaration statement. And it matches with my script file name also.
Sorry for the above post, found the issue with declaration. The scriptBlock was in another folder. It was a folder hierarchy problem. Will remove the errors and see if it is working
Ok Thanks RobotsVsWizards and svenskefan, i solved the problem with your help.