Witam. Nie mogę przeciągnąć gotowego prefabu(sphere) do skryptu(zmiennej)
Dlaczego?
public Rigidbody bullet;
Poniżej cały skrypt.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Shooter : MonoBehaviour {
// Use this for initialization
public Rigidbody bullet;
public float power = 1500f;
public float movespeed = 2f;
// Update is called once per frame
void Update ()
{
float hor = Input.GetAxis ("Horizontal") * Time.deltaTime * movespeed; // pozioma
float ver = Input.GetAxis ("Vertical") * Time.deltaTime * movespeed; // pionowa
transform.Translate(hor,ver,0);
if (Input.GetButtonUp ("Fire1"))
{
Rigidbody instance = Instantiate (bullet, transform.position, transform.rotation);
Vector3 forward = transform.TransformDirection (Vector3.forward);
instance.AddForce (forward * power);
}
}
}