- Home /
Question by
kaleetos · Aug 07, 2011 at 01:44 PM ·
errorexceptionmissingfieldexception
Missing Field Exception
This line of javascript code:
collider.enabled = false;
is producing this exception:
MissingFieldException: Field 'UnityEngine.SphereCollider.enabled' not found.
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+
cAnonStorey16.<>mC ()
Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.SetProperty (System.Object target, System.String name, System.Object value)
DoDamageOnContact.OnCollisionEnter (UnityEngine.Collision hit) (at Assets/Scripts/Enemy&Asteroids/DoDamageOnContact.js:20)
Is this a bug or am I missing something?
Comment
Answer by IgorAherne · Jul 16, 2013 at 04:26 PM
Try this (not tested):
if(this.collider){ this.collider.enabled = false; } else Debug.Log("there is no collider attached along with this script");
Your answer
Follow this Question
Related Questions
Help with error: UnassignedReferenceException 5 Answers
can someone help me with this error please? 1 Answer
Package directory not found for DataContractSerialization 1 Answer
IndexOutOfRangeException 1 Answer
Null Reference Exception Error 1 Answer