public void StopMoving() { foreach (KeyValuePair <string, Stack <GameObject> > pair in buffer) { Stack <GameObject> objectBuffer = pair.Value; foreach (GameObject i in objectBuffer) { ObjectControl ic = i.GetComponent <ObjectControl>(); if (ic) { ic.DisableMovement(); } } } }