有个文件夹里面有很多的图片,都是.png格式的,要是一个一个的拖到脚本上觉得很麻烦,就写了一个遍历添加的cars,变量是List<Sprite> 代码如下: using UnityEngine; using System.IO; using System.Collections.Generic; public class NewBehaviourScript : MonoBehaviour { private List<Texture> cars = new List<Tex
import os def iterbrowse(path): for home, dirs, files in os.walk(path): for filename in files: yield os.path.join(home, filename) for fullname in iterbrowse("文件夹目录"): if fullname.endswith('.py'): print(fullname)