- Home /
Error in shooting script
Hi, I have a simple shooting system into my game, the system is creating the bullets but not adding the velocity and moving the bullets forward.
var Bullet : Transform;
var Speed = 10;
function Update () {
if (Input.GetButtonUp ("Fire1"))
{
clone = Instantiate(Bullet, transform.position, transform.rotation);
clone.velocity = transform.TransformDirection(Vector3 (0, 0, Speed));
Destroy (clone.gameObject, 5);
audio.Play();
particleSystem.Play();
}
}
This is the error: MissingFieldException: UnityEngine.Transform.velocity Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.FindExtension (IEnumerable`1 candidates) Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.Create (SetOrGet gos) Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.CreateSetter () Boo.Lang.Runtime.RuntimeServices.DoCreatePropSetDispatcher (System.Object target, System.Type type, System.String name, System.Object value) Boo.Lang.Runtime.RuntimeServices.CreatePropSetDispatcher (System.Object target, System.String name, System.Object value) Boo.Lang.Runtime.RuntimeServices+c_AnonStorey19.<>m_F () Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.SetProperty (System.Object target, System.String name, System.Object value) Shoot.Update () (at Assets/Scripts/Shoot.js:9)
Your answer
Follow this Question
Related Questions
How should I handle masses of bullets? 1 Answer
Problem with Shooting Accuracy 0 Answers
Ship won't shoot right in SMHUP. Help?? 2 Answers
Shooting causes character to shoot forward 2 Answers
AirStrike Scripting Help 0 Answers