I wrote a script with C# and I wanna call the function of it using JavaScript.
When I using android platform an error note with BCE0019: ‘enabled’ is not a member of ‘Object’.
I know the I havn’t created an android plugin. Could someone tells me a detail steps to use the script enabled function.
Thx in advance.
Script:
var script;
script = gameObject.GetComponent(“CanReplay”); script.enabled = true;
p.s CanReplay is C# script that I want to enalbed.
Unity can’t guess what’s the script variable type, and assumes the generic object type. You should declare its type like this:
var script: CanReplay = gameObject.GetComponent("CanReplay");
script.enabled = true;
But CS and JS can’t see each other because the compilers are independent. If Unity complains that “CanReplay isn’t a valid type” or something like this, you can use another trick: declare script as a MonoBehaviour:
var script: MonoBehaviour = gameObject.GetComponent("CanReplay");
script.enabled = true;
Hello guys please help me by fix my script .I want to active my car controller script in by writng script in java i use this script on PC Platform its work perfect But when i awitched on Android PlateForm the following error appear
“Enabled” is not a member of unity…Please help professional guys…I use this script on Pc Platform
Var Carcontroll : GameObject;
function Start () {
CarControll.GetComponent(“CarScriptName”).enabled =true;
}
Its work perfect for Pc Platform But For Android Platform “enabled” is not a member of unity error comes