ロバメモ - 素人のUnity覚書と奮闘記

素人のUnity覚書と奮闘記

エラー

リワード広告を使ってみた

UnityでAdmobのリワード広告を使ってみたので方法と注意点をメモ。 導入方法 コード 遭遇したエラーと対処法 エラー内容 原因 対処法 テスト広告についての問題点 〜保留中〜 導入方法 リワード広告 | Unity | Google Developers 概ね、公式通りでできた。 …

ScripttableObjectを継承したクラスのインスタンスを作成したら警告された

エラー内容 原因 対処方法 エラー内容 MyTable must be instantiated using the ScriptableObject.CreateInstance method instead of new MyTable. UnityEngine.ScriptableObject:.ctor() 原因 上記のMyTableというのは、ScripttableObjectを継承したクラス…

'IndexOf'はカルチャ対応で、StringComparison 引数がありません

Visual Studioを使いだしてから、タイトル内容 " 'IndexOf'はカルチャ対応で、StringComparison 引数がありません "の注意が出るようになった。 気になったので、調べてみた。 エラー内容 StringComparisonって何? 省略した場合は、どれになるの? 対処方法…

PlayerPrefsを使ったWebGLをphpに置いた時に生じた不具合と回避策

サイトの仕組み 生じた不具合 セーブデータファイルが作成される場所 回避策 サイトの仕組み 私のサイトはphpで作成している。 といっても、高度なことはできなくて、ただヘッダー・フッター・メニューなどを分けて読み込むだけの単純なもの。 <div id="right_container"> </div> //サイト内…

Game scripts or other custom code contains OnMouse_ event handlers. Presence of such handlers might impact performance on handheld devices.

エラー内容 Game scripts or other custom code contains OnMouse_ event handlers. Presence of such handlers might impact performance on handheld devices. Android / IOS を選んでビルドした際に出たエラー。 OnMouse~イベントを使っていると出るらし…

GetComponent()以外で他のクラスを参照するには?

やりたいこと MonoBehaviourを継承しない場合 MonoBehaviourを継承する場合 やりたいこと 他のクラスを参照するとき、ゲームオブジェクトにクラスをアタッチして、GameObject.Find("object_name").GetComponent<MyClass>()といった感じでアクセスする方法多いんだけど</myclass>…

Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)

エラー内容 Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?) 原因と対処方法 OnDestroy時にInstantiateでGameObjectを配置するとでるエラー。 OnDestroyではInstantiateしないようにする。 例 …

Error : You are trying to create a MonoBehaviour using the 'new' keyword.

You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all MonoBehavior…

Error : Failed to create agent because it is not close enough to the NavMesh

エラー内容 解決策 参考にしたサイト様 エラー内容 NaviMeshを使っていて、エージェントをスクリプトで配置しようとしたら、黄色い警告文が出た。 Failed to create agent because it is not close enough to the NavMesh 機械翻訳だと それがNavMeshに十分…

CommandInvokationFailure: Failed to re-package resources. See the Console for details.

AdMob入れてビルドしようとしたら、このエラー。 CommandInvokationFailure: Failed to re-package resources. See the Console for details. ・SDK入れ直す ・SDKバージョンを変える ・JDK入れ直す ・JDKバージョンを変える ・AdMob入れ直す ・AdMobパッケ…

Metal: Editor support disabled, skipping device initialization

エラー内容 Metal: Editor support disabled, skipping device initialization 対処方法 Players & Settings画面から、other settings - PCまたはiOSタブ - Metal Editor Support にチェックを入れる。

Error building Player because scripts have compile errors in the editor

エラー内容 Error building Player because scripts have compile errors in the editor 対処方法 スクリプトをEditorフォルダに入れる。

ERROR : A valid provisioning profile for this executable was not found.

xcodeで実機テストするときに、ビルドは成功したのにインストールできずに、次のエラーが出た場合。 A valid provisioning profile for this executable was not found. 実機テストの場合は、profileをdebugのほうもDevelopmentに設定しないといけない。

Error: 'pod' command not found; unable to generate a usable Xcode project. You can install cocoapods with the Ruby gem package manager:

UnityでiOSビルドするとこんなエラーが出た。 ‘pod’ command not found; unable to generate a usable Xcode project. You can install cocoapods with the Ruby gem package manager: sudo gem install -n /usr/local/bin cocoapods pod setup UnityEngine.…

Error: [Temp/StagingArea/AndroidManifest-main.xml:12,

Androidでビルドしようとしたら、下記のようなエラーが出た。 Error: [Temp/StagingArea/AndroidManifest-main.xml:12, /プロジェクトのパス/Temp/StagingArea/android-libraries/GoogleMobileAdsPlugin/AndroidManifest.xml:2] Main manifest has <uses-sdk android:minSdkVersion=‘9’> but libr</uses-sdk>…

エラー:Unknown type name 'GADNativeCustomTemplateAd'; did you mean 'GADUNativeCustomTemplateAd'?

xcodeで以下のエラーが出た場合 Unknown type name ‘GADNativeCustomTemplateAd’; did you mean ‘GADUNativeCustomTemplateAd’? Build Sttings → Apple LLVM8.1 - Language - Modulesの項目にある Enable Modules(C and Objective-C) をYesにする。