Beispiel #1
0
    // 通过unity获取外部(摄像头等)图像,传入sdk
    public void SaveToIOS()
    {
        Texture2D t2d = m_textImage.sprite.texture;

        byte[] bytes    = t2d.EncodeToJPG();
        string savePath = Application.persistentDataPath + "/testImage.jpg";

        //[iOS]/var/mobile/Containers/Data/Application/1B59CF4F-855D-4712-9375-C7131B9FC560/Documents/testImage.jpg

        File.WriteAllBytes(savePath, bytes);
        Debug.Log("已保存到:" + savePath);

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            OSHookBridge.ImagePathToIOS(savePath);
        }
    }