// Methods private void Awake() { #if UNITY_EDITOR if (_singleton != null) { Debug.LogError( string.Format("Created multiple NativePluginLoader objects. Destroying duplicate created on GameObject [{0}]", gameObject.name)); Destroy(this); return; } _singleton = this; DontDestroyOnLoad(gameObject); DirectoryInfo parentDirectory = Directory.GetParent(Application.dataPath); string parentDirectoryStr = parentDirectory.FullName; _path = parentDirectoryStr + "\\Resources\\Plugins\\"; if (SystemLibrary.SetDllDirectory(_path)) { LoadAll(); } else { Debug.Assert(false, "Could not set the dll directory path correctly, maybe the folder does not exist, please make sure the path exist!"); } #endif }
private void OnDestroy() { #if UNITY_EDITOR UnloadAll(); _singleton = null; #endif }
// Methods void Awake() { if (_singleton != null) { Debug.LogError( string.Format("Created multiple NativePluginLoader objects. Destroying duplicate created on GameObject [{0}]", this.gameObject.name)); Destroy(this); return; } _singleton = this; DontDestroyOnLoad(this.gameObject); _path = Application.dataPath + "/Plugins/"; LoadAll(); }
void OnDestroy() { UnloadAll(); _singleton = null; }