private void CreateAtomRCSprite(int type, int start, int end, ArrayList atomLocationalist, Color c, Vector3 v, int order) { LinkedSpriteManager linkedSpriteManager = null; GameObject SpriteManager; if (!GameObject.Find("SpriteManager")) { SpriteManager = new GameObject(); SpriteManager.name = "SpriteManager"; } else { SpriteManager = GameObject.Find("SpriteManager"); } SpriteManager.GetComponent <MeshRenderer>().enabled = true; if (SpriteManager.GetComponent <LinkedSpriteManager>() == null) { SpriteManager.AddComponent("LinkedSpriteManager"); linkedSpriteManager = (LinkedSpriteManager)Component.FindObjectOfType(typeof(LinkedSpriteManager)); Material mat = Resources.Load("Materials/hyperballshader", typeof(Material)) as Material; linkedSpriteManager.material = mat; linkedSpriteManager.allocBlockSize = atomLocationalist.Count; } else { linkedSpriteManager = (LinkedSpriteManager)Component.FindObjectOfType(typeof(LinkedSpriteManager)); linkedSpriteManager.allocBlockSize = atomLocationalist.Count; linkedSpriteManager.enabled = true; } GameObject Atom; float[] fLocation = atomLocationalist[start] as float[]; Vector3 location = new Vector3(fLocation[0], fLocation[1], fLocation[2]); UnityEngine.Object o; o = MonoBehaviour.Instantiate(Resources.Load("HBspriteplane"), location, new Quaternion(0f, 0f, 0f, 0f)); Atom = (GameObject)o; MoleculeModel.atoms.Add(Atom); Atom.renderer.material.SetColor("_Color", c); BallUpdateHB comp = Atom.GetComponent <BallUpdateHB>(); comp.rayon = (float)(v[0]); comp.atomcolor = c; comp.number = order; comp.enabled = true; linkedSpriteManager.AddSprite(Atom, 1f, 1f, 0, 0, 256, 256, true); switch (type) { case 0: Atom.tag = "C"; break; case 1: Atom.tag = "N"; break; case 2: Atom.tag = "O"; break; case 3: Atom.tag = "S"; break; case 4: Atom.tag = "P"; break; case 5: Atom.tag = "H"; break; default: Atom.tag = "X"; break; } }