// Use this for initialization void Start() { GameObject goVolumeController = GameObject.Find("BGM"); // TODO -- define this globally if (goVolumeController) { volumeController = goVolumeController.GetComponent<VolumeController>(); if (!volumeController) { Debug.Log("\"Volume Controller\" game object has no \"VolumeController\" component."); } volumeController.RegisterPlayer(this); } else { Debug.Log("Could not find object named \"Volume Controller\" in the scene."); } body2D = GetComponent<Rigidbody2D>(); }