# UnityEditor.HierarchyProperty not found

**URL:** <https://discussions.unity.com/t/unityeditor-hierarchyproperty-not-found/422828>\
**Category:** Scripting\
**Tags:** Scripting\
**Created:** [September 12, 2010, 1:12am UTC](https://discussions.unity.com/t/unityeditor-hierarchyproperty-not-found/422828 "2010-09-12T01:12:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fivearchers\_1](https://avatars.discourse-cdn.com/v4/letter/f/a9adbd/32.png) [@fivearchers\_1](https://discussions.unity.com/u/fivearchers_1)\
**Post date:** [September 12, 2010, 1:12am UTC](https://discussions.unity.com/t/unityeditor-hierarchyproperty-not-found/422828/1 "2010-09-12T01:12:32Z")

</div>

Keep getting this error, but randomly:

Full Error from log:

```auto
MissingFieldException: Field 'UnityEditor.HierarchyProperty.speed' not found.
  at Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.FindExtension (IEnumerable`1 candidates) [0x00000] in <filename unknown>:0 

  at Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.Create (SetOrGet gos) [0x00000] in <filename unknown>:0 

  at Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.CreateSetter () [0x00000] in <filename unknown>:0 

  at Boo.Lang.Runtime.RuntimeServices.DoCreatePropSetDispatcher (System.Object target, System.Type type, System.String name, System.Object value) [0x00000] in <filename unknown>:0 

  at Boo.Lang.Runtime.RuntimeServices.CreatePropSetDispatcher (System.Object target, System.String name, System.Object value) [0x00000] in <filename unknown>:0 

  at Boo.Lang.Runtime.RuntimeServices+<SetProperty>c __AnonStorey17.<>m__ D () [0x00000] in <filename unknown>:0 

  at Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) [0x00000] in <filename unknown>:0 

  at Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) [0x00000] in <filename unknown>:0 

  at Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) [0x00000] in <filename unknown>:0 

  at Boo.Lang.Runtime.RuntimeServices.SetProperty (System.Object target, System.String name, System.Object value) [0x00000] in <filename unknown>:0 

  at jsGun+$Fire$25+$.MoveNext () [0x00056] in C:\Users\quentin\Documents\Unity Projects\hacknslash\Assets\items\jsGun.js:55 
UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
jsGun:Update() (at Assets\items\jsGun.js:33)

```

Snippet of Code it points to:

```auto
	var state:AnimationState;
	for (state in animation) {
		state.speed = fAniSpeed;
	}

```

Note that I declare state outside of the for loop because I was trying to figure out what was happening with a different error, where I’d get a casting error:

```auto
InvalidCastException: Cannot cast from source type to destination type.
  at jsGun+$Fire$25+$.MoveNext () [0x00023] in C:\Users\quentin\Documents\Unity Projects\hacknslash\Assets\items\jsGun.js:53 
UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
jsGun:Update() (at Assets\items\jsGun.js:33)

```

Can’t quite figure out what is going on![/code]

---

<div class="post-metadata">

**Author:** ![andeeeee](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@andeeeee](https://discussions.unity.com/u/andeeeee)\
**Post date:** [September 13, 2010, 3:46pm UTC](https://discussions.unity.com/t/unityeditor-hierarchyproperty-not-found/422828/2 "2010-09-13T15:46:42Z")

</div>

Are you calling this from the Update function? If so, can you post the whole function.

---

<div class="post-metadata">

**Author:** ![fivearchers\_1](https://avatars.discourse-cdn.com/v4/letter/f/a9adbd/32.png) [@fivearchers\_1](https://discussions.unity.com/u/fivearchers_1)\
**Post date:** [September 13, 2010, 4:21pm UTC](https://discussions.unity.com/t/unityeditor-hierarchyproperty-not-found/422828/3 "2010-09-13T16:21:42Z")

</div>

I will post the function after work. It’s not in the update function per se, it’s in another function that’s basically waiting on a yield, for the length of time of the animation. Possibly could be a timing issue?

---

<div class="post-metadata">

**Author:** ![fivearchers\_1](https://avatars.discourse-cdn.com/v4/letter/f/a9adbd/32.png) [@fivearchers\_1](https://discussions.unity.com/u/fivearchers_1)\
**Post date:** [September 13, 2010, 11:22pm UTC](https://discussions.unity.com/t/unityeditor-hierarchyproperty-not-found/422828/4 "2010-09-13T23:22:11Z")

</div>

Here’s the complete script:

```auto
var sSource:String;
var sIdle:String="Idle";
var sReload:String="Reload";
var sFire:String="Fire";
var sFireAuto:String="FireAuto";
var pfAmmo:GameObject;
var fAniSpeed:float=1;
private var tSource:Transform;
private var bReloading:boolean=false;
private var myOwner:GameObject;
var iClipSize:int=10;
private var iClip:int;
var soundShoot:AudioClip;
var soundReload:AudioClip;

function Start(){
	iClip=iClipSize;
	for (var state : AnimationState in animation) {
		state.speed = 1;
	}
	animation.Play(sReload);
	bReloading=true;
	yield new WaitForSeconds(animation.clip.length);
	bReloading=false;
	
	var allChildren = gameObject.GetComponentsInChildren(Transform);
	for (var child : Transform in allChildren) {
		if (child.name=="SOURCE"){tSource=child;}
	}
} 
	
function SetOwner(newOwner:GameObject){
	myOwner=newOwner;
}

function Update () {
	if (!bReloading iClip!=0){
		if (Input.GetButton("Fire1")){Fire();}
	}
	else if (!bReloading iClip==0){
		if (Input.GetButton("Fire1")){Reload();}
	}
}

function Reload(){
	bReloading=true;
	// [0] - Game Object requesting the ammo
	// [1] - type of Ammo
	// [2] - Quantity requested
	var ammostack=new Array();
	ammostack[0]=gameObject;
	ammostack[1]=0; //NOTE: Later must decide and specify ammo types
	ammostack[2]=iClipSize;
	myOwner.SendMessage("RequestAmmo",ammostack);
	//At this point we are locked until the parent sends us some ammo!
}

function ReceiveAmmo(ammoreceipt:int){
	if (ammoreceipt>0){
		for (var state : AnimationState in animation) {
			state.speed = 1;
		}
		animation.Play(sReload);
		yield new WaitForSeconds(animation.clip.length);
		iClip=ammoreceipt;
		bReloading=false;
	}
	else {
	// NO AMMO RECEIVED, KEEP BUGGING HOST?
		 yield new WaitForSeconds(0.25);
		 Reload();
	}
}

function Fire(){
	if (animation!=null){
		bReloading=true;
		var state:AnimationState;
		for (state in animation) {
			state.speed = fAniSpeed;
		}
		audio.clip=soundShoot;
		audio.Play();
		animation.Play(sFire);
		var shot=Instantiate(pfAmmo,tSource.position,tSource.rotation);
		shot.tag=transform.tag;
		Physics.IgnoreCollision(shot.collider,transform.parent.gameObject.collider);
		yield new WaitForSeconds(animation.clip.length/fAniSpeed);
		iClip--;
		bReloading=false;
	}
}

```
