Call JS variables and functions from C#??

Hi,

I download that: Unity3D: JavaScript -> C# or C# -> JavaScript access | 41 Post

And the example works… So, I created a new project, and I create a new folder call Standard Assets on the Assets folder, and I created a new file call JSTest, and outside another file CSTest…

In the CSTest:

using UnityEngine;
using System.Collections;

public class CSTest : MonoBehaviour {

	private JSTest Tester;

	// Use this for initialization
	void Start () {
		Tester = this.GetComponent<JSTest>();
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}

But inmediatly the JSTest turns red (because it wasn’t found), and the following warning appear:

Assets/CSTest.cs(6,24): warning CS0414: The private field `CSTest.Tester' is assigned but its value is never used

What can I do??

Thanks in advance.
Bye.

This warning mean that You have declared variable but You newer used it. It’s not an error so code should work fine.

If you using Visual Studio(i’m using 2012, don’t know for rest versions) for coding, it will always mark this as error, because it’s not recognizing JS scripts (so You can’t access them).

Hope that helps,
Paul