開発環境
Macbook Pro /macOS High Sierra 10.13.6
Unity2018.2.5
質問させていただきます。
〜本題〜
Unity2017.2.0を先日まで使っていたのですが、Unity2018.2.5をインストールしてプロジェクトを動かそうとしたところ、以下の2つのエラーが出ました。
error CS0122: `UnityEngine.Texture.Texture()' is inaccessible due to its protection level
error CS1540: Cannot access protected member UnityEngine.Texture.Texture()' via a qualifier of type
UnityEngine.Texture'. The qualifier must be of type `TextureBogusExtensions' or derived from it
Unity2017.2.0使用時にはこのエラーは出ていませんでした。
以下ソース
using UnityEngine; using System.Collections; using System.Text; /// <summary> /// /// Add a feature to the Texture class which allows you to detect the case when you have attempted to download a bogus WWW Texture. /// /// by Matt "Trip" Maker, Monstrous Company :: http://monstro.us /// /// TODO could also use the filesystem cache to keep the example error image between runs. /// /// from http://unifycommunity.com/wiki/index.php?title=TextureBogusExtensions /// /// </summary> public static class TextureBogusExtensions { public static bool ready = false; private static Texture _bogusTexture = null; public static Texture bogusTexture { get { return _bogusTexture; } set { _bogusTexture = value; } } public static bool obtainExampleBogusTexture() { Debug.Log("obtaining an example bogus texture by trying to load an HTML page as a texture"); bool keepgoing = true; float timeoutAt = Time.time + 10.0f; _bogusTexture = new Texture(); WWW www = new WWW("http://monstro.us");
ソースはhttp://wiki.unity3d.com/index.php?title=TextureBogusExtensionsと同じです。
色々調べたのですがお手上げ状態です。ソースを修正すれば良いのか、Unityのバージョンを変えるしかないのか、、、皆様のアイディア、お力をお借りできたら幸いです。
よろしくおねがいたします。
〜なぜUnity2018.2.5を入れたのか?〜
Unity2017.2.0をずっと使っていたのですが、サーバーとのデータのやり取りをしようとすると毎回、”JSON parse error: Invalid value”というエラーが出ました。
Unityをアップデートしたら直るかなと思い、最新のUnity2018.2.5を入れてコンパイルエラーを起こしているのが今の状況です。
追記1
Unity 2017.4.10をインストールしたところ上の2つのエラーは出なくなりました。
しかし”JSON parse error: Invalid value”は出てしまいます。
追記2
”JSON parse error: Invalid value”が解決できました。
原因はサーバーからのstring型の返り値に””がついていなかったことが原因でした。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2018/08/28 05:44