AssetDatabase
- AddObjectToAsset
- AssetPathToGUID
- ClearLabels
- CompleteLabel
- Contains
- CopyAsset
- CreateAsset
- CreateFolder
- DeleteAsset
- ExportPackage
- GenerateUniqueAssetPath
- GetAssetPath
- GetCachedIcon
- GetDependencies
- GetLabels
- GetTextMetaDataPathFromA...
- GUIDToAssetPath
- ImportAsset
- ImportPackage
- IsMainAsset
- LoadAllAssetRepresentations...
- LoadAllAssetsAtPath
- LoadAssetAtPath
- LoadMainAssetAtPath
- MoveAssetToTrash
- MoveAsset
- OpenAsset
- Refresh
- RenameAsset
- SaveAssets
- SetLabels
- StartAssetEditing
- StopAssetEditing
- ValidateMoveAsset
AssetDatabase.GetAssetPath 获取资源路径
static function GetAssetPath (assetObject : Object) : string
static function GetAssetPath (instanceID : int) : string
Description描述
Returns the path name relative to the project folder where the asset is stored
返回相对于工程资源位置的路径名。
All paths are relative to the project folder. Like: "Assets/MyTextures/hello.png"
所有的路径都是相对于工程目录文件。 例如” Assets/MyTextures/hello.png”
@MenuItem("GameObject/Create Material")
static function CreateMaterial () {
// Create a simple material asset
//新建一个简单的材质资源
var material = new Material (Shader.Find("Specular"));
AssetDatabase.CreateAsset(material, "Assets/MyMaterial.mat");
// Print the path of the created asset
//打印新建资源的路径
Debug.Log(AssetDatabase.GetAssetPath(material));
}
最后修改:2011年5月31日 Tuesday 14:44