The "true" parameter that you have set is meant for allowSceneObjects, so you will be able to drag a scene object into that field, however I am unsure if passing your own type will always work.
From what I've seen it is only able to use type that Unity recognize, Transform, GameObject, TextAsset (which could be .txt, .cs, .ja), etc.
Also, your object in the Scene doesn't necessary share the same type of the one in your asset folder.
For instance, your could specify a MonoBehaviour attatched to a GameObject
MonoA myMonoA = null;
myMonoA = EditorGUILayout.ObjectField("My Mono A", myMonoA, typeof(MonoA), true) as MonoA;
and be able to drag it from the scene with a GameObject on which it is attached to.
However, if you drag and drop the same "MonoBehaviour" from your Asset folder MonoA.cs
well, your out of luck, because in that case it is a TextAsset
. So as you can see, the type don't match.
Edit 1
For a prefab though, I was able to drag and drop using the GameObject
or the Object
. I guess you could want to drap and drop a prefab as an Object
and later do GameObject.Instantiate(thatObject);
But even there, I'm not sure how you would detect the "real" type of the object dragged in with Unity. With Object
I was able to drag a folder from the Project view, but his type seems to be DefaultAsset, so at that point it might be hard to know if what you've got is a folder or a prefab.
Edit 2
Finding more way to do this, since I currently need something similar, there is the AssetDatabase.GetAssetPath(myFoo)
function which returns you the full path of the Asset. I doubled checked, and it does returns the extension as well.
So if the object pass is a prefab, it would return /The/Full/Path/myFoo.prefab, if it's a folder it would return /The/Full/Path/myFoo or a script /The/Full/Path/myFoo.cs.
You could write your own file detection here to handle what you want, and set back myFoo object to null with a user message if that type isn't supported by your scriptable object.