void Start() { #if UNITY_EDITOR if (!File.Exists(getConfigURL())) { if (!Directory.Exists(Application.streamingAssetsPath)) { Directory.CreateDirectory(Application.streamingAssetsPath); } File.Copy(Application.dataPath + "/FaceSDK/" + configFileName, Application.streamingAssetsPath + "/" + configFileName); } #endif if (instance != null) { Debug.LogError("Repeat to create"); GameObject.DestroyImmediate(gameObject); return; } instance = this; source.target = this; staticVideoWidth = source.GetWidth(); staticVideoHeight = source.GetHeight(); trackerData = new TrackerData(); trackerData.node = new List <Vector3> (); trackerData.facePose = new float[6]; trackerData.exp = new float[21]; trackerData.p3dnode = new List <Vector3>(); trackerData.maskVertexes = new List <Vector3> (); trackerData.maskIndexs = new List <int> (); #if UNITY_ANDROID && !UNITY_EDITOR if (!File.Exists(Application.persistentDataPath + "/" + configFileName)) { StartCoroutine(load()); } else { StartWork(); } #else StartWork(); #endif }
void OnDestroy() { instance = null; Debug.Log("Destroy!"); }