public void Dispose() { MainCharacterRenderer?.Dispose(); MainCharacterRenderer = null; foreach (var renderer in CharacterRenderers.Values) { renderer.Dispose(); } CharacterRenderers.Clear(); }
private void Awake() { rbody = GetComponent <Rigidbody2D>(); isoRenderer = GetComponentInChildren <MainCharacterRenderer>(); foreach (Sound sound in sounds) { sound.source = gameObject.AddComponent <AudioSource>(); sound.source.clip = sound.clip; } }