- Home /
Need to use 2 different language scripts.
Hi again, I'm trying to use these 2 scripts:
Javascript one:
var skinGUI : GUISkin; var logoTexture : Texture2D;
var LoadingScreen : LoadingScreen = null;
function Start() { LoadingScreen = new LoadingScreen(); }
function theFirstMenu() { GUI.BeginGroup(Rect(Screen.width / 2 - 150, Screen.height / 2, 300, 200)); GUI.Box(Rect(0, 0, 300, 100), "");
 if(GUI.Button(Rect(55, 18, 180, 40), "Start game")) {
  LoadingScreen.Load("Main Scene");
 }
 if(GUI.Button(Rect(55, 52, 180, 40), "Quit")) {
  Application.Quit();
 }
   
 GUI.EndGroup();
}
function OnGUI () { GUI.skin = skinGUI;
 theFirstMenu();
}
C Sharp one:
using UnityEngine;
public class LoadingScreen : MonoBehaviour { public Texture2D texture; static LoadingScreen instance;
 void Awake()
 {
     if (instance)
     {
         Destroy(gameObject);
         return;
     }
     instance = this;    
     gameObject.AddComponent<GUITexture>().enabled = false;
     guiTexture.texture = texture;
     transform.position = new Vector3(0.5f, 0.5f, 0.0f);
     DontDestroyOnLoad(this); 
 }
 public static void Load(int index)
 {
     if (NoInstance()) return;
     instance.guiTexture.enabled = true;
     Application.LoadLevel(index);
     instance.guiTexture.enabled = false;
 }
 public static void Load(string name)
 {
     if (NoInstance()) return;
     instance.guiTexture.enabled = true;
     Application.LoadLevel(name);
     instance.guiTexture.enabled = false;
 }
 static bool NoInstance()
 {
     if (!instance)
         Debug.LogError("Loading Screen is not existing in scene.");
     return instance;
 }
}
But the console says: "Assets/MainMenu/MainMenuScript.js(4,21): BCE0018: The name 'LoadingScreen' does not denote a valid type ('not found')."
Obs.: The 2 scripts are in the same folder.
Answer by Bunny83 · Jul 28, 2012 at 03:18 AM
I don't explain it again. This really has been asked too often...
Here's the page you need:
http://docs.unity3d.com/Documentation/ScriptReference/index.Script_compilation_28Advanced29.html
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                