diff --git a/popcorn/Assets/MyGame/Scripts/CoinManager.cs b/popcorn/Assets/MyGame/Scripts/CoinManager.cs index d925aa9a..dd1c5c75 100644 --- a/popcorn/Assets/MyGame/Scripts/CoinManager.cs +++ b/popcorn/Assets/MyGame/Scripts/CoinManager.cs @@ -40,7 +40,7 @@ public class CoinManager : SingletonMonoBehaviour coinCountText.CountUpAnimation(coinTextFormat, ownCoin, duration); } - public void AddCoinWithEffect(int count, Action callback) + public void AddCoinWithEffect(int count, Action callback = null) { ownCoin += count; // 生成枚数決定 @@ -48,7 +48,7 @@ public class CoinManager : SingletonMonoBehaviour InstantiateEffeect(coinPrefab, count, Vector3.zero, coinIconTransform.position, () => { coinCountText.CountUpAnimation(coinTextFormat, ownCoin, duration); - callback.Invoke(); + callback?.Invoke(); }); }