Answer the question
In order to leave comments, you need to log in
Is an object not removed when it collides with another?
using System.Collections;
using System.Collections.Generic;
using System.Security.Cryptography;
using UnityEngine;
public class Bird : MonoBehaviour
{
public float force;
Rigidbody2D BirdRigid;
void Start()
{
BirdRigid = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0)) {
BirdRigid.velocity = Vector2.up * force;
}
}
private void OnCollisionEnter2D(Collision2D collision)
{
if(collision.collider.tag == "Enemy")
{
Destroy(gameObject);
}
}
}
Вот код
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question