Can I pass a value from a C# Script into a Java Script?

I have a value calculated inside my C# script that I need to use in my Java script. Is there a way to pass it over?

You can access your C# scripts and their variables from JavaScript if those files are compiled in the right order. You would need your C# script to be in PlugIns or Standard Assets for it to be visible to the JavaScript that isn’t in those locations. If you want to see JavaScript from C# script the opposite is true and the JavaScript has to be in Plugins or Standard Assets and the C# somewhere else.

you can make the java script see the C# script as a component … then you can use any of its variables … something like this :

C# Script

using UnityEngine;
using System.Collections;

public class SharpScript : MonoBehaviour {
	
	public int myValue = 100; // this is the value that we want to 	use in javaScript
	
}

JavaScript

var curValue : int;
var gObject2 : GameObject; // this is the object that contains the C# script


function Update () 
{
	var cSharpScript = gObject2.GetComponent("SharpScript");
	
	curValue = cSharpScript.myValue;
}

So I have a question…

How would you do the opposite? I need to access a javascript variable in a C# class.