1
hello I am making a 2d platform game in Unity and I made an item that to Oce Pegalo Oceoce will be able to jump higher but I would like to put a timer (I don’t want it to appear on the screen)for the effect to pass after a specific time and do not know how you could help me this the code of my item
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Crystal : MonoBehaviour
{
[Header("Boost")]
[SerializeField] float jumpBoost = 10f;
[Header("SFX")]
[SerializeField] AudioClip pickupSFX;
[SerializeField] [Range(1f, 10f)] float pickupSFXVolume = 10f;
//cached referns
Player player;
private void Start()
{
player = FindObjectOfType<Player>();
}
private void OnTriggerEnter2D(Collider2D collision)
{
AudioSource.PlayClipAtPoint(pickupSFX, Camera.main.transform.position, pickupSFXVolume);
player.jumpForce += jumpBoost;
Destroy(gameObject);
}
}
Important you [Dit] your question and explain objectively and punctually the difficulty found, accompanied by a [mcve] of the problem and attempt to solve. To better enjoy the site, understand and avoid closures and negativities worth reading the Stack Overflow Survival Guide in English.
– Bacco