-1
我需要用圖像的高度和寬度來縮放飛機,所以飛機的主要紋理不會伸展。 這樣的:如何在運行時獲取本機圖像大小?
void LoadBG()
{
string bgpaht = Application.persistentDataPath +"/a.png";
if (File.Exists(bgpath))
{
byte[] bgbyte=File.ReadAllBytes(bgpath);
...
...
Texture2D t2d = new Texture2D(a.width,a.height);
t2d.LoadImage(bgbyte);
plane.transform.localScale = new Vector3(t2d.width,1.0f,t2d.height);
plane.renderer.material.mainTexture=t2d;
}
}
好了,現在我怎樣才能像「a.png」的寬度和高度?
我同意你的形象,但我想在IOS去實現它,所以我不能找到合適的「System.Drawing.dll程序」 –
我的上帝,我是如此粗心,回答「http://docs.unity3d.com/ScriptReference/Texture2D.LoadImage.html」 –