Hi, I have script named Core. In others scrips I wroted this
public Core core;
public className(Core MainCore) {
core = MainCore;
}
in Core:
using UnityEngine;
using System.Collections;
public class Core : MonoBehaviour {
private MySQL mysql;
private NetworkManager networkManager;
private Login login;
private FirstPlay firstplay;
private Hud hud;
private Loading loading;
private Typ typ;
private PlayerManager playermanager;
void Start () {
mysql = new MySQL(this);
networkManager = new NetworkManager(this);
login = new Login(this);
firstplay = new FirstPlay(this);
hud = new Hud(this);
loading = new Loading(this);
playermanager = new PlayerManager(this);
}
public MySQL getMySQL() { return mysql; }
public NetworkManager getNetworkManager() { return networkManager; }
public Login getLogin() { return login; }
public FirstPlay getFirstPlay() { return firstplay; }
public Hud getHud() { return hud; }
public Loading getLoading() { return loading; }
public PlayerManager getPlayerManager() { return playermanager; }
}
How I can make instance without this errors ? PS: I can’t use static.
You are trying to create a
MonoBehaviour using the ‘new’ keyword.
This is not allowed. MonoBehaviours
can only be added using
AddComponent(). Alternatively, your
script can inherit from
ScriptableObject or no base class at
all UnityEngine.MonoBehaviour:.ctor()