- Home /
Question is off-topic or not relevant
Call JS variables and functions from C#??
Hi,
I download that: http://www.41post.com/1935/programming/unity3d-js-cs-or-cs-js-access
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.
Answer by legion_44 · Jan 08, 2014 at 05:02 PM
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
I know what that warning mean, and I use $$anonymous$$onoDevelop, but why in the example that works??
Follow this Question
Related Questions
How Do I Update a cSharp script var from js? 2 Answers
Switching multiple cameras 0 Answers
How do i call a variable from another script? 1 Answer