S
S
SkrinV2019-11-15 17:02:18
C++ / C#
SkrinV, 2019-11-15 17:02:18

How to destroy 2 objects on contact in Unity?

I need to make a script so that when 2 objects touch with the help of a collider in a unit, they are destroyed
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Del : MonoBehavior
{
public GameObject bullet;
public GameObject cel;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if Collision(col = cel)
{
Destroy(bullet, 0.1f);
Destroy(cel, 0.1f);
}
}
}
But there are a lot of errors in the code itself, and the code itself is not correct, can you help in correcting the code? (If anything, then the game is in 3D)
Thanks in advance

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question