(I'm a beginner) I wrote some code here that breaks a box when it collides strongly with a collider (any kind, but I don't know how to do animation and effects yet), I wanted to know your opinion about this, and if you want, you can direct me on how to write it or find out something
using UnityEngine;
public class See : MonoBehaviour
{
// breaking boxes
privat string Tag = "_cardbox";
privat GameObject pl = player;
privat float power = 8f;
privat GemaObject fl = floor;
privat string Tag = "Object1" ;
void Update()
{
if (Tag("_cardbox") => power, Collision.collision(Tag("Object1"), fl))
Destroy(Tag("_cardbox"))
else
return;
//If the box falls or hits another object or obstacle, it breaks.
}
}