// Use this for initialization void Start() { extended = moveDirection * moveAmount; retracted = gameObject.transform.localPosition; extended = retracted + extended; gameObject.SetActive(false); GameObject sc = GameObject.Find("BlockSoundController"); if (sc) { soundController = sc.GetComponent <BlockSoundController>(); } }
private void PlayBlockMoving() { if (soundController) { soundController.BlockMoving(); } else { GameObject sc = GameObject.Find("BlockSoundController"); if (sc) { soundController = sc.GetComponent <BlockSoundController>(); soundController.BlockMoving(); } else { Debug.Log("No Sound Controller"); } } }