Код: Выделить всё
//private void OnCollisionEnter(Collision collision)
//{
// Destroy(gameObject);
//}
Код: Выделить всё
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bullet : MonoBehaviour
{
Rigidbody rigidbody;
// Start is called before the first frame update
void Awake()
{
rigidbody = GetComponent();
}
public void InitializeBullet(Vector3 originalDirection)
{
transform.forward = originalDirection;
rigidbody.velocity = transform.forward * 18f;
}
//private void OnCollisionEnter(Collision collision)
//{
// Destroy(gameObject);
//}

Подробнее здесь: https://stackoverflow.com/questions/699 ... gameobject