Google Service Unity Plugin中文教程及下载地址

梁丘飞鸾
2023-12-01

Google  Service Unity Plugin

 

Google Service Unity Plugin 包含了google的多个服务的unity插件,

其中包括admob unity,firebase analytic unity,google analytic unity,google play game unity等插件。

google play game unity插件支持google 排行榜,google游戏成就,google play game 任务,google game即时任务等等全部接口。

c#和js开发者能方便的在unity editor里面集成google service Unity plugin

 

下面是几个使用google service plugin的例子

 

### 在unity 游戏里面展示admob广告

 

         using admob;

         Admob.Instance().initAdmob("ca-app-pub-3940256099942544/2934735716", "ca-app-pub-3940256099942544/4411468910");

         Admob.Instance().showBannerRelative(AdSize.Banner, AdPosition.BOTTOM_CENTER, 30, "defaultBanner");

 

上面只用了2行代码就可以展示admob横幅广告了

 

### unity3d中使用firebase analytic

 

         using google.service.game;

         FirebaseAnalytic.Instance().logEvent("appstart", "{\"time\":\"112222\",\"name\":\"demouser\"}");

 

上面只用了一行代码来在unity游戏里统计一个事件

 

###  Unity 中使用google play game api

 

1. u3d中使用 google play service登录游戏

```

         using google.service.game;

         GoogleGame.Instance().login (true, false);

```

2. google play game unity plugin 在unity游戏中展示排行榜

```

         GoogleGame.Instance().showLeaderboards();

```

3. u3d游戏中展示google play game成就

```

         GoogleGame.Instance().showAchievements();

```

 

google service unity 插件官方地址   https://github.com/unity-plugins/google-play-game-service-unity-plugin/

转载于:https://my.oschina.net/u/3199239/blog/819075

 类似资料: