1. 先到微信开放平台下载SDK
- 地址:https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419319164&lang=zh_CN
- 将 SDK 下载下来,解压后会有如图几个文件:
2. 将上图的文件放置在 unity 项目的 Plugin(Plugins)–>iOS 位置下
3. Unity 中脚本编写
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Runtime.InteropServices;//这是DllImport的头文件
using System.IO;
/// <summary>
/// 下载图片后分享至微信
/// </summary>
public class save : MonoBehaviour {
//这是调用在 Xcode 写的微信分享的函数
[DllImport("__Internal")]
private static extern void ShareByIos(int type,string url