1、动态加载图片问题,报null
Head_Image.sprite = Resources.Load<Sprite>("Head_Image/Student");
如果你的Student图片类型是2d And UI,那么Default后面不加.png类型后缀。
Texture2D imageLoad = (Texture2D)Resources.Load("Head_Image/Student");
Sprite texSprite = Sprite.Create(imageLoad, new Rect(0, 0, imageLoad.width, imageLoad.height), new Vector2(0.5f, 0.5f));
Head_Image.sprite = texSprite;
如果你的Student图片类型是Default类型,那么Student后面也不加.png类型后缀。直接加载Texture2D,然后创建Sprite,最后接收就行了
总结:去他喵的后缀类型!