Hey everyone, I’m just creating a platform game where you are a cube and you have to pass the level, there are many Enemies on the level and I would like that if Player touches Enemy this becomes physical and Rigidbody2D (Dynamic) will turn on.
Here is my script that is in Player but it doesn’t work, can anyone know how to fix it?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
private Rigidbody2D rb;
public class EnableComponents : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody2D>();
Rigidbody2D.isDynamic = false;
}
// Update is called once per frame
void Update()
{
void OnCollisionEnter2D(Collision2D col)
{
if (col.gameObject.tag == "Enemy")
{
Rigidbody2D.isDynamic = true;
}
}
}
}