here is the script. how can i fiz this error. expecting :, found ‘=’.
look my problem in this video
i have this code attach to the GUItexture button. and at the end another script attach to th 3d Teapot.
here is the script. how can i fiz this error. expecting :, found ‘=’.
look my problem in this video
i have this code attach to the GUItexture button. and at the end another script attach to th 3d Teapot.
It would be easier to look at your code if you posted it in code notation , to do this when making a post , click “go advanced” to switch to the full text editor then select all your code and click on the # icon which will wrap the code in code tags and display it better.
Also try to narrow down the error to a line number in your code
i fix the message , please take a look at the video i post to you, see the problem.
I see an error here :
if(MyScriptName.vuforiaVisible);
{
You have a semi-colon inbetween the closing round brace and opening curly brace of an if statement . Remove this semi-colon
DUde i gotta question your logic writing this:
myObject.renderer.enabled = myScript.enabledState!=myScript.enabledState
this always returns false because you are constantly checking against itself. so the renderer will never be enabled.
also you are missing a ; at the end of myScript.enabledState
it should be :
myObject.renderer.enabled = myScript.enabledState!=myScript.enabledState;
i put what you say here, look at the errors.
Assets/b2.js(28,18): BCE0020: An instance of type ‘MyScriptName’ is required to access non static member ‘vuforiaVisible’.
Assets/b2.js(31,34): BCE0005: Unknown identifier: ‘myScript’.
Quick question
in MyScriptName
is the variable vuforiaVisible static
and if not i think you should use yourScriptInstance.vuforiaVisible instead of that.
also where are you instantiating the myScript variable, I do not see it anywhere.
MyScriptName is the name of Java script, i attach it to the 3D object name, teapot.
inside the MyScriptName.js is this.
and this java script name b2 is attach to the GUItexture.button
Ok as shader bytes stated
this:
if (yourScriptInstance.vuforiaVisible);
{
myObject.renderer.enabled = myScript.enabledState!=myScript.enabledState;
}
}
needs to be this:
if (yourScriptInstance.vuforiaVisible)
{
myObject.renderer.enabled = myScript.enabledState!=myScript.enabledState;
}
}
but other than that there should be no errors (as far as I can see) what errors do you get. also where are you creating myScript, if anything I think you should change myScript to yourScriptInstance because myScript is not instanciated anywhere.
Assets/b2.js(32,27): BCE0044: expecting :, found ‘=’.
I think this is what you want is something like this:
if(yourScriptInstance.enabledState != yourScriptInstance.enabledState)
{
myObject.renderer.enabled = false;
}
as that is what your code translates into. also edited my above post on what that whole function should look like. please check it out again.
the same error.
Assets/b2.js(39,27): BCE0044: expecting :, found ‘=’.