文档

Unity Engine

Unity Engine

assetPath

The path name of the asset being imported.
阅读时间1 分钟最后更新于 1 个月前

Definition

  • Type: Property
  • Namespace: UnityEditor
  • Assembly: UnityEditor
public string assetPath { get; set; }

Examples

using UnityEngine;using UnityEditor;// Automatically sets Textures settings upon first import and prints the// path from where is being importedclass CustomImportSettings : AssetPostprocessor{ void OnPreprocessTexture() { Debug.Log("Importing texture to: " + assetPath); TextureImporter importer = (TextureImporter)assetImporter; importer.textureFormat = TextureImporterFormat.ARGB32; importer.isReadable = true; importer.mipmapEnabled = false; }}