Hi,
I have a strange problem. The first few objects of my gameobject array which contains the asset previews from the specified folder return none or a missing texture. And every second time building the scene the textures from Element 10 to 20 are none or missing and the textures that were none before are assigned properly.
My code:
using UnityEngine;
using System.Collections;
using UnityEditor;
public class Items : MonoBehaviour
{
public GameObject[] item;
public Texture2D[] itemIcon;
void Start ()
{
itemIcon = new Texture2D[item.Length];
for(int i = 0; i < item.Length; i++)
itemIcon _= AssetPreview.GetAssetPreview(item*);*_
}
}
I’m using Unity 4.
Sorry for my english
[12535-unbenannt0.png|12535]
[12536-unbenannt.jpg|12536]
It looks like a bug in Unity. See duplicate here: http://answers.unity3d.com/questions/259608/editorutiltiygetassetpreviewobject-asset.html
– Bathtub