So, I have simple C# class to call basic game functions to populate the game.
using UnityEngine;
using System.Collections;
public class StaticGameFunctions : MonoBehaviour {
public static void CreateTileBoardWithCurrentBoardData()
{
Debug.Log("ButtonClick!!! Create Tile Board");
}
}
I can call this function via:
StaticGameFunctions.CreateTileBoardWithCurrentBoardData();
from other monoBehaviour objects.
However, I have a previously written javascript that gets dropped on a clickable onscreen button that I want to use to trigger the function.
function OnMouseUp () {
if(buttonActive){
guiTexture.texture = hoverLitTex;
StaticGameFunctions.CreateTileBoardWithCurrentBoardData();
}else{
guiTexture.texture = hoverDimTex;
}
}
And in this case, I am getting an error: BCE0005:Unknown identifier: ‘StaticGameFunctions’. I’ve tried “import” on various things, moving the scripts around in the folders, but I can’t get the mouse button code to recognize the StaticGameFunctions class (while others can). Is there something I’m missing, aside from the potential c#/Javascript difference?