using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class CallSubButton : MonoBehaviour { public void SubButton_Click () { SceneManager.LoadScene("SubScence", LoadSceneMode.Additive); Scene scene = SceneManager.GetSceneByName("SubScence"); while (!scene.isLoaded) { yield return null; } //指定したシーン名をアクティブにする SceneManager.SetActiveScene(scene); } }
SceneManager.LoadScene("SubScence", LoadSceneMode.Additive);// ←シーン追加のためMainScenceに重なる(透けて見える) SceneManager.LoadScene("SubScence", LoadSceneMode.Single); //シーン移動 (LOAD無効になる?)
error CS1624 : The body of '' cannot be an iterator block because 'void' is not an iterator interface type
void を外すと以下エラー
error CS1520 : Class,struct, or interface method must have a return type
もとにもどし、
while (!scene.isLoaded) { yield return null; }
をコメントアウトするとエラーが消えます。
質問
・MainCameraのBackground色設定だけでは、Scenceを重ねた場合に透過されてしまうのか
(画像を背景にしないと、他のScenceのUI等が見えてしまうのか)
・yield return null; がエラーになってしまう理由
(ほかの参考サイト等では上記のように書いてあったので、その通りにコピペしただけなのにうまくいきません)
以上、よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/05/16 23:48