「Unity/おすすめアセット/紙吹雪」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→kayacの紙吹雪) |
|||
行29: | 行29: | ||
} | } | ||
</pre> | </pre> | ||
+ | |||
+ | ==confetti-fx-2== | ||
+ | https://assetstore.unity.com/packages/vfx/particles/confetti-fx-2-170027?aid=1101lkNYi&utm_campaign=unity_affiliate&utm_medium=affiliate&utm_source=partnerize-linkmaker |
2022年3月19日 (土) 23:43時点における版
kayacの紙吹雪
- https://techblog.kayac.com/unity-physically-simulated-confetti にあるunitypackageを入れる
- prefab/Confetiをシーンに置く
- Confeti.csを空オブジェクトにAddComponentする
公式:https://techblog.kayac.com/unity-physically-simulated-confetti
5秒ごとに紙吹雪花火サンプル(Dotween必須)
void Confetti() { GameObject prefab = playRunView.confettiPrefab; GameObject confettiObject = Instantiate(prefab, Vector3.zero, Quaternion.identity); confettiObject.transform.localScale = new Vector3(0.03f, 0.03f, 0.03f); Vector3 initPosition = new Vector3(82, 5, 1); // Vector3 initPosition = new Vector3(0, 5, 1); confettiObject.GetComponent<Confetti>().PieceWidth = 3f; confettiObject.GetComponent<Confetti>().PieceLength = 3f; confettiObject.transform.localPosition = new Vector3(initPosition.x, 0, initPosition.z); var sequence = DOTween.Sequence(); sequence.Append(confettiObject.transform.DOLocalMoveY(initPosition.y, 0.5f)); sequence.Append(confettiObject.transform.DOLocalMoveY(initPosition.y * 0.8f, 5f)); sequence.Play().OnComplete(() => { confettiObject.GetComponent<Confetti>().EmitPiecePerSecond = 0; Confetti(); }); }