Forum Discussion
molton
12 years agoExplorer
I need help activatting a javascript component from c#
Hello, I can't seem to figure this out, I was hoping somebody here knows of a good solution for this. I have javascript image effects attached to the CameraRight and CameraLeft GameObjects but I really don't know how to access the script and I'm having trouble finding an answer, I think partly because of how searching for "access javascript from c#" brings up a lot of different results, I'm hoping somebody on here can share a solution. Thanks in advance.
3 Replies
Replies have been turned off for this discussion
- CurtisExplorerTypically, you would just move the C# to a suitable place in regards to script compilation order.
http://docs.unity3d.com/Manual/ScriptCompileOrderFolders.html
But if that isn't suitable for what you are trying to do, you can create a couple of "dummy" scripts. For instance you have your main C# script, create another C# script in the standard assets folder and attach it to the same gameObject as your main C# script. Create variables in the new C# script for the stuff you want to pass to java. Now in your original script, where you were trying to pass to java pass to the new script.
Then create a javascript, attach it to your camera, and you should be able to access variables from the dummy script you put in standard assets, as well as the image effect script.
Hope that helps - moltonExplorerThanks, that's all it was!? I was reading about these big long solutions for using javascript from a c# script in Unity that didn't work, and all I had to do was move the javascript I was trying to access into the plugins folder I guess.
- CurtisExplorerNo problem, glad you got it sorted out :)
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device