I am currently working on a editor script that requires me to make use of http://System.IO, because Unity does not seem to have a function for getting every prefab in a specific asset folder. And i therefore have to use http://System.IO to get every file with a ".prefab" extension in the folder and then loop trough that list using
But as i want this editor script to work on multiple machines with the project in different locations. As well as working on both Mac and Windows. I need a way to get the absolute path of the currently opened unity project. How do i do that?
So it would be something like this on windows:
And something like this on the mac:
You can use relative paths like "Assets/MyPrefabs/Prefab1.prefab".
Application class contains a bunch of properties which return project paths, look into that.
answered Apr 30 '12 at 09:17 AM
Application.dataPath is what you are looking for.
answered Aug 08 '12 at 11:27 AM