I’m having a hard time getting a JS script and a CS script talking to eachother. It might not even be possible.
Basically i have an array in a JS file i want to give to a CS script, but no matter what i do it errors. This is some example code demonstrating a lack of communication between the script types. I have no problems with JS->JS.
Javascript file:
function Update () {
NewBehaviourScript.quest=false;
}
C# file:
using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
static bool quest = false;
// Use this for initialization
void Start () {
quest = true;
}
// Update is called once per frame
void Update () {
}
}
If i try accessing the JS file from the C# file it gives the error:
Assets/NewBehaviourScript.cs(17,9): error CS0103: The name `first’ does not exist in the current context
Oh, i see it has something to do with the order of compiling. This is a little odd. I’ll try creating a folder called Standard Assets and put a script in it and see how it goes.
I agree about sticking to one script type. I’m just trying to make use of a script i converted from C++ to C#. With all the hassle, i might try converted it to js instead of c#.
Assets/Scripts/Login/User.cs(1514,39): error CS0176: Static member `User.Stats.eq1’ cannot be accessed with an instance reference, qualify it with a type name instead
public int
error CS0122: `User.stats’ is inaccessible due to its protection level