public void AddToTrainingSet(Unit unit, double identity) { MeshRenderer mr = unit.GetComponent <MeshRenderer> (); Texture tex = mr.material.mainTexture; PhantomUnit pu = ScriptableObject.CreateInstance <PhantomUnit>(); pu.Initialize(tex, identity); trainingSet.Add(pu); }
public void AddToTrainingSet(Color[] pixels, double identity, int width, int height) { Texture2D tex = new Texture2D(width, height); tex.SetPixels(pixels); tex.Apply(); PhantomUnit pu = ScriptableObject.CreateInstance <PhantomUnit>(); pu.Initialize(tex, identity); trainingSet.Add(pu); }