I’ve used Collider 2d in both the gameobject, Is trigger is also marked and used Rigidbody 2D in one of the gameobject and body type is also Dynamic, gravity is set to zero,
But it’s still not working I’ve checked everything is correct but it’s still not working
No “Warning” No “error” but it’s still not working,
Please, fellow programmers help me out,
The Script I’ve written is mentioned below:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Powerup : MonoBehaviour {
[SerializeField]
private float _speed = 4.0f;
// Update is called once per frame
void Update ()
{
transform.Translate(Vector3.down * _speed * Time.deltaTime);
}
void OnTriggerEnter2d(Collider2D other)
{
Debug.Log("Collided with: " + other.name);
/*
if(other.tag == "Player" )
{
Player player = other.GetComponent<Player>();
if(player != null)
{
player.canTripleFire = true;
}
Destroy(this.gameObject);
} */
}
}