$begingroup$

right here is my script :

utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;
utilizing System;    

public class powerup : MonoBehaviour {

    public float multiplier = 2f;
    public float length = 4f;
    
    public GameObject PickupEffect;

    void OnTriggerEnter (BoxCollider different)
    {
        if(different.CompareTag("Automobile"))
        {
            startcoroutine   (  Pickup(different));
        }
    }

    IEnumerator Pickup(BoxCollider Automobile)
    {
        Instantiate(PickupEffect, rework.place, rework.rotation);
        Automobile.rework.localScale *= multiplier;    
        yield return new WaitForSeconds(length);

        Automobile.rework.localScale /= multiplier;


        Destroy(gameObject);
    }
}

$endgroup$

1


Not the reply you are searching for? Browse different questions tagged .