- Home /
AssetDatabase.CreateFolder question
Hello everyone.
I'm having some questions about the AssetDatabase.CreateFolder function.
I've created a new folder just fine, simply by using the regular code: "AssetDatabase.CreateFolder("Assets", "My Folder");" But I can't find a way to look inside the Assests folder, and check if the "My folder" already exists (using JAVA).
Also, now talking about the AssetDatabase class, I've read it on the unity API that "To use it (AssetDatabase) you have to place your script in Assets/Editor inside your project folder", but it worked just fine on my regular scripts inside Assets. So I was wondering what kind of functions or situations I would need to place an script inside this Editor folder and, on that case, how could I access that new script.
Any kind of help would be appreciated!
Answer by FatWednesday · Sep 07, 2012 at 03:11 PM
As to the first point, I dont tend to use java myself but this post looks like it might explain a way of doing that in java http://www.coderanch.com/t/381117/java/java/find-whether-folder-exists-or
As for editor scripts, Editor scripts (which should always go in the Editor folder in Assets) are scripts relating to customization of the unity environment, such as custom inspector windows, custom tool windows, etc. This doc should explain this in mor details http://docs.unity3d.com/Documentation/Components/gui-ExtendingEditor.html
The reason that any code using the AssetDatabase should be in here is because the AssetDatabase will not exist in you're final game, it is only there to assist in the manipulation of the asset and folders in your project whilst in the editor. You can access these scripts just like you would other scripts (as its all still the same namespace in the editor) but its unlikely that you will want other scripts to access editor scripts (unless editor scripts themselves) again because these scripts wont exist in the final build, they are only for the editor.
hope this helps.
I see! Well, that actually helped!
In fact I rather use C# on most cases, but I'm building this project for an exercise, and it was mandatory to use Java.
As far as I know, Unity does not support Java, but Javascript, which are not the same and are not related in any way besides the na$$anonymous$$g.