Unity Coin Collect Effect , UI Overlay

So I wonder if anyone knows how to obtain this effect.


As shown in the following video, the diamond sprites gets attracted towards the counter. Please help me obtain this effect.


My assumptions are, they probably used Particle effects and Force field. But, since I haven’t done it, I have no exact idea.


164543-asd.gif

using UnityEngine;
using DG.Tweening;
using TMPro;
public class GemMagnetEffect : MonoBehaviour
{
public GameObject Gemprefab;
public GameObject _gemparent;
public Transform Gemcollector, MoneyUIParent;
public TextMeshProUGUI currencyText;

private void Start()
{

}

public void spawnDiamond(Vector3 pos, int coinAmount)
{
    //iOSHapticController.instance.TriggerNotificationSuccess();
    //int coinAmount = Random.Range(1, 4);
    for (int i = 0; i < coinAmount; i++)
    {
        Transform t = Instantiate(Gemprefab.transform, transform.position, Quaternion.identity, _gemparent.transform);
        
        //disable sparkle particle
        t.GetChild(0).GetChild(0).gameObject.SetActive(false);
       // t.gameObject.layer = diamondLayer;
        t.gameObject.SetActive(true);
        Vector2 canvasPos;
        Vector2 screenPoint = Camera.main.WorldToScreenPoint(pos);
        RectTransformUtility.ScreenPointToLocalPointInRectangle(_gemparent.GetComponent<RectTransform>(), screenPoint, Camera.main, out canvasPos);
        t.localPosition = canvasPos;
        t.transform.localScale = new Vector3(1f, 1f, 1f);
        float size = Random.Range(30f - 5f * i, 30f - 5f * i);
        t.DOScale(new Vector3(size, size, size), 0.1f);
        Vector3 randomPos = new Vector3(Random.Range(t.localPosition.x - 100, t.localPosition.x + 100),
                                        Random.Range(t.localPosition.y - 100, t.localPosition.y + 100),
                                        0);
        float time = Random.Range(.3f, .6f);
        t.DOLocalRotate(new Vector3(Random.Range(0, 360), Random.Range(0, 360), Random.Range(0, 360)), time).SetEase(Ease.Linear);
        Sequence seq = DOTween.Sequence();
        Vector3 finalPos = Gemcollector.localPosition;
        seq.Append(t.DOLocalMove(randomPos, Random.Range(.3f, .6f)).SetEase(Ease.Linear));
        seq.Append(t.DOLocalMove(finalPos, time).SetEase(Ease.Linear));
        seq.Join(t.DOScale(new Vector3(15, 12, 15), time).SetDelay(0.2f));
        seq.OnComplete(() =>
        {
            //MMVibrationManager.Haptic(HapticTypes.MediumImpact);
            Destroy(t.gameObject);

            PREF_DATA.COINS++;
            currencyText.text = PREF_DATA.COINS.ToString();

            MoneyUIParent.DOPunchScale(new Vector3(0.2f, 0.2f, 0.2f), .3f);
            MoneyUIParent.DOScale(new Vector3(1, 1, 1), 0.4f);
        });
    }
}

//public LayerMask diamondLayer;
public void spawnCoinOnUI(Vector3 pos, int coinAmount)
{
    int amountToAdd = 1;
    int remainder = 0;

    if (coinAmount > 100)
    {
        amountToAdd = coinAmount / 100;
        remainder = coinAmount % 100;
        coinAmount = 100;

        //add reminders to coin
        PREF_DATA.COINS += remainder;
    }



    for (int i = 0; i < coinAmount; i++)
    {
        Transform t = Instantiate(Gemprefab.transform, transform.position, Quaternion.identity, _gemparent.transform);
        t.gameObject.SetActive(true);
        //t.gameObject.layer = diamondLayer;

        t.localPosition = Vector3.zero;
        t.transform.localScale = Gemprefab.transform.localScale;
        t.transform.localEulerAngles = Vector3.zero;
        Vector3 randomPos = new Vector3(Random.Range(t.localPosition.x - 150, t.localPosition.x + 150),
                                        Random.Range(t.localPosition.y - 150, t.localPosition.y + 150),
                                        0);
        Sequence seq = DOTween.Sequence();
        

        seq.Append(t.DOLocalMove(randomPos, Random.Range(.3f, .6f)).SetEase(Ease.OutBack)).OnComplete(()=> {

            //t.GetComponent<diamondMove>().diamondTarget = Gemcollector.GetComponent<RectTransform>();
        });
        seq.Append(t.DOMove(Gemcollector.position, Random.Range(.3f, .6f)).SetEase(Ease.Linear));
        seq.OnComplete(() =>
        {
            //MMVibrationManager.Haptic(HapticTypes.MediumImpact);
            Destroy(t.gameObject);
            PREF_DATA.COINS += amountToAdd;
            currencyText.text = PREF_DATA.COINS.ToString();
        });
    }
}

}