/// <summary> /// this performs the load from Objs instead of an .assetBundle /// it is used in case no .assetBundle exists and by CreateAssetBundles to create the asset bundles in the first place. /// </summary> /// <param name="subjectName">Subject name.</param> /// <param name="average_brain">If set to <c>true</c> average brain.</param> public void ObjSpawn(string subjectName, bool average_brain = false) { float startTime = Time.time; GameObject subject = new GameObject(subjectName); subject.transform.parent = gameObject.transform; hcp = new GameObject("hcp"); hcp.transform.parent = subject.transform; dk = new GameObject("dk"); dk.transform.parent = subject.transform; dkLeftParent = new GameObject("dk left"); dkLeftParent.transform.parent = dk.transform; dkRightParent = new GameObject("dk right"); dkRightParent.transform.parent = dk.transform; hcpLeftParent = new GameObject("hcp left"); hcpLeftParent.transform.parent = hcp.transform; hcpRightParent = new GameObject("hcp right"); hcpRightParent.transform.parent = hcp.transform; //CoroutineWithData objListRequest = new CoroutineWithData (this, RhinoRequestor.ObjFilePathListRequest (subjectName)); //yield return objListRequest.coroutine; string[] filenames = RhinoRequestor.EditorObjFilePathListRequest(subjectName);//(string[])objListRequest.result; //Debug.Log (filenames.Length); foreach (string filename in filenames) { if (System.IO.Path.GetExtension(filename).Equals(".obj")) { //if (loadingText != null) // loadingText.text = "Downloading: " + filename; EditorFileRequestToObj(subjectName, filename); } else { loadingText.text = "Error: I got a non-obj file from list objs get: " + filename; throw new UnityException("I got a non-obj file from list objs get: " + filename); } } Debug.Log("Load finished: " + (Time.time - startTime).ToString()); //due to weirdness, flip everything gameObject.transform.localScale = new Vector3(-gameObject.transform.localScale.x, gameObject.transform.localScale.y, gameObject.transform.localScale.z); hcp.SetActive(false); }