回答編集履歴
1
スクリプト追記
test
CHANGED
@@ -13,3 +13,79 @@
|
|
13
13
|
|
14
14
|
|
15
15
|
[SceneManagement.SceneManager.LoadSceneAsync - Unity スクリプトリファレンス](https://docs.unity3d.com/jp/current/ScriptReference/SceneManagement.SceneManager.LoadSceneAsync.html)
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
---
|
20
|
+
|
21
|
+
ものすごくざっくり書いたコードです。
|
22
|
+
|
23
|
+
負荷の考慮もしていませんので参考程度に使用してください。
|
24
|
+
|
25
|
+
また、以下ページもご確認ください。
|
26
|
+
|
27
|
+
[https://teratail.com/help/question-tips](https://teratail.com/help/question-tips)
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
```C#
|
32
|
+
|
33
|
+
using System.Collections;
|
34
|
+
|
35
|
+
using System.Collections.Generic;
|
36
|
+
|
37
|
+
using UnityEngine;
|
38
|
+
|
39
|
+
using UnityEngine.SceneManagement;
|
40
|
+
|
41
|
+
using UnityEngine.Video;
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
public class LoadScene : MonoBehaviour {
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
private AsyncOperation asyncLoad;
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
void Start () {
|
54
|
+
|
55
|
+
//シーン名は適宜変えてください
|
56
|
+
|
57
|
+
asyncLoad = SceneManager.LoadSceneAsync("シーン2", LoadSceneMode.Additive);
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
// Update is called once per frame
|
64
|
+
|
65
|
+
void Update () {
|
66
|
+
|
67
|
+
//ロードが完了している時に
|
68
|
+
|
69
|
+
if (asyncLoad.isDone) {
|
70
|
+
|
71
|
+
//スペースキーが入力されたら
|
72
|
+
|
73
|
+
if (Input.GetKeyDown(KeyCode.Space))
|
74
|
+
|
75
|
+
{
|
76
|
+
|
77
|
+
//シーン2のビデオを再生する(オブジェクト名は適宜変えてください)
|
78
|
+
|
79
|
+
GameObject.Find ("シーン2のVideoPlayerのオブジェクト名").GetComponent<VideoPlayer> ().Play ();
|
80
|
+
|
81
|
+
}
|
82
|
+
|
83
|
+
}
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
```
|