Синтаксис:
Используется csharp
using UnityEngine;
using System.Collections;
public class Fire : MonoBehaviour
{
public GameObject _bulletPrefab;
public int Pover;
void Update ()
{
if (Input.GetKeyDown(KeyCode.Mouse0))
{
FireBullet();
}
}
void FireBullet()
{
Transform boolet = (Transform) Instantiate(_bulletPrefab, GameObject.Find("BulletSpavn").transform.position, Quaternion.identity);
boolet.rigidbody.AddForce(transform.forward * Pover);
}
}
using System.Collections;
public class Fire : MonoBehaviour
{
public GameObject _bulletPrefab;
public int Pover;
void Update ()
{
if (Input.GetKeyDown(KeyCode.Mouse0))
{
FireBullet();
}
}
void FireBullet()
{
Transform boolet = (Transform) Instantiate(_bulletPrefab, GameObject.Find("BulletSpavn").transform.position, Quaternion.identity);
boolet.rigidbody.AddForce(transform.forward * Pover);
}
}
Вылетает с ошибкой (Смотри прикрепленную картинку) Снаряд не летит(
Подскажите где косяк