GameObject obj = GameObject.Find ("オブジェクト名"); GameObject Packman = GameObject.Find ("PackMan"); GameObject.Find ("Score").GetComponent<GUIText> ().text = "テキスト内容";
if(collision.gameObject.CompareTag("Enemy")){ Object.Destroy(gameObject); }
GameObject[] objs = GameObject.FindGameObjectWithTag ("タグ名"); GameObject[] objs = GameObject.FindGameObjectWithTag ("Sphere"); foreach (GameObject obj in objs) { if (obj.name != "Sphere") { Color c = obj.GetComponent<Renderer> ().material.color; c.a = 0.5f; obj.GetComponent<Renderer> ().material.color = c; obj.GetComponent<Renderer> ().material.shader= Shader.Find ("GUI/Text Shader"); } }