Unity」カテゴリーアーカイブ

ゲームエンジン「Unity」に関するカテゴリーです。

忍者AdMaxがUnityに対応

サムライファクトリーのSSP(Supply Side Platform)がUnityにも対応しました。

Unity製アプリに最速で広告を実装
忍者AdMaxを始める (adf.shinobi.jp)

Unityでのアプリ広告掲載フローは以下の通りです。

  1. 忍者ツールズに新規ユーザー登録後、忍者AdMaxのサービスを追加
  2. AdMaxSDK Unity Pluginをインポートして、Prefabを追加

AdMaxSDK.unitypackageは以下のページからダウンロード可能です。

GitHub – ninjatools/admax-unity-plugin: AdMaxSDKをUnityで簡単に使えるようにしたプラグインです。
https://github.com/ninjatools/admax-unity-plugin (配布終了しました → 関連記事

Unityアプリだけでなく、ブログやホームページでの広告にも対応しています。

GoogleのAdMob/AdSenseと比べても手続きが簡単なので、とりあえず登録&試してみてもいいかなと思います。


忍者AdMaxでアプリのマネタイズ

UnityのMaterialのTilingやOffsetの値をスクリプトから変更する方法

SetTextureOffsetSetTextureScaleを使うことで、MaterialのTilingやOffsetの値を変更できるようです。

使い方は次のような感じです。

Renderer renderer = GetComponent<Renderer> ();

Vector2 offset = new Vector2(...);
Vector2 scale = new Vector2(...);

renderer.material.SetTextureOffset("_MainTex", offset);
renderer.material.SetTextureScale("_MainTex", scale);
renderer.material.SetTextureOffset("_BumpMap", offset);
renderer.material.SetTextureScale("_BumpMap", scale);

リンク

How to change Tiling / Offset of all generated Textures by script?
https://forum.allegorithmic.com/index.php?topic=3077.0

Unity Editorからのデバッグ時のみ実行するifdef

UNITY_EDITORを使うと、Unity Editorでのデバッグ時のみ実行するコードを書けるようです。

使い方は次のような感じです。

#if UNITY_EDITOR
Debug.log("debug");
#endif

他、UNITY_ANDROIDUNITY_IPHONE等も便利そうです。

リンク

Unity – Platform Dependent Compilation
https://docs.unity3d.com/351/Documentation/Manual/PlatformDependentCompilation.html