I’m simply trying to assign an empty gameobj “EndOfBarrel” to my BulletPrefab’s public transform slot. Unity will not let me do this. I tried putting the bullet pref in the scene and then dragging “EndOfBarrel” to the slot no go either. What is the problem?
bullet script:
using UnityEngine;
using System.Collections;
public class Bullet : MonoBehaviour {
public Transform endOfBarrel2;
void Start()
{
GameObject.Find ("EndOfBarrel");
}
void Update()
{
if (transform.position.z > 100)
{
transform.position = endOfBarrel2.position;
}
}
}