質問編集履歴
14
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -265,3 +265,5 @@
|
|
265
265
|
}
|
266
266
|
|
267
267
|
```
|
268
|
+
|
269
|
+
[GOd内容](https://www.youtube.com/watch?v=hFyANXapLIk)
|
13
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -179,3 +179,89 @@
|
|
179
179
|
|
180
180
|
|
181
181
|
[リンク内容](http://tech.pjin.jp/blog/2016/12/14/unity_minor_1/)
|
182
|
+
|
183
|
+
```ここに言語を入力
|
184
|
+
|
185
|
+
using UnityEngine;
|
186
|
+
|
187
|
+
using System.Collections;
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
public class Minor_1 : MonoBehaviour
|
192
|
+
|
193
|
+
{
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
public Transform followTfm;
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
bool onStert = false;
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
float smoothTime = 0.1f;
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
Vector3 velocity = Vector3.zero;
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
void Start()
|
214
|
+
|
215
|
+
{
|
216
|
+
|
217
|
+
gameObject.SetActive(true);
|
218
|
+
|
219
|
+
Invoke("DelayMethod", 3.5f);
|
220
|
+
|
221
|
+
}
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
void Update()
|
226
|
+
|
227
|
+
{
|
228
|
+
|
229
|
+
if (onStert)
|
230
|
+
|
231
|
+
{
|
232
|
+
|
233
|
+
// 追従対象オブジェクトのTransformから、目的地を算出
|
234
|
+
|
235
|
+
Vector3 targetPos = followTfm.TransformPoint(new Vector3(3f, 3f, 7f));
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
// 移動
|
240
|
+
|
241
|
+
transform.position =
|
242
|
+
|
243
|
+
Vector3.SmoothDamp(transform.position, targetPos, ref velocity, smoothTime);
|
244
|
+
|
245
|
+
Invoke("DelayMethodA", 0.3f);
|
246
|
+
|
247
|
+
}
|
248
|
+
|
249
|
+
}
|
250
|
+
|
251
|
+
void DelayMethod(){
|
252
|
+
|
253
|
+
onStert = true;
|
254
|
+
|
255
|
+
}
|
256
|
+
|
257
|
+
void DelayMethodA()
|
258
|
+
|
259
|
+
{
|
260
|
+
|
261
|
+
gameObject.SetActive(false);
|
262
|
+
|
263
|
+
}
|
264
|
+
|
265
|
+
}
|
266
|
+
|
267
|
+
```
|
12
url
test
CHANGED
File without changes
|
test
CHANGED
@@ -176,4 +176,6 @@
|
|
176
176
|
|
177
177
|
|
178
178
|
|
179
|
+
|
180
|
+
|
179
|
-
http://tech.pjin.jp/blog/2016/12/14/unity_minor_1/
|
181
|
+
[リンク内容](http://tech.pjin.jp/blog/2016/12/14/unity_minor_1/)
|
11
url追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -171,3 +171,9 @@
|
|
171
171
|
|
172
172
|
|
173
173
|
NullReferenceException:オブジェクト参照がオブジェクトのインスタンスに設定されていない
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
http://tech.pjin.jp/blog/2016/12/14/unity_minor_1/
|
10
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -112,7 +112,7 @@
|
|
112
112
|
|
113
113
|
}else if(acd == 2){
|
114
114
|
|
115
|
-
transform.position = transform.position + new Vector3(0,
|
115
|
+
transform.position = transform.position + new Vector3(0, 5, 0);
|
116
116
|
|
117
117
|
}
|
118
118
|
|
@@ -120,9 +120,17 @@
|
|
120
120
|
|
121
121
|
}
|
122
122
|
|
123
|
+
public void CubeStrt()
|
124
|
+
|
125
|
+
{
|
126
|
+
|
127
|
+
Invoke("DelayMethodA", 1.0f);
|
128
|
+
|
129
|
+
}
|
123
130
|
|
124
131
|
|
132
|
+
|
125
|
-
|
133
|
+
void DelayMethodA()
|
126
134
|
|
127
135
|
{
|
128
136
|
|
@@ -132,13 +140,15 @@
|
|
132
140
|
|
133
141
|
this.acd = 2;
|
134
142
|
|
135
|
-
Invoke("DelayMethod", 0.
|
143
|
+
Invoke("DelayMethodB", 0.1f);
|
136
144
|
|
137
145
|
}
|
138
146
|
|
139
147
|
}
|
140
148
|
|
149
|
+
|
150
|
+
|
141
|
-
void DelayMethod()
|
151
|
+
void DelayMethodB()
|
142
152
|
|
143
153
|
{
|
144
154
|
|
9
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -64,6 +64,94 @@
|
|
64
64
|
|
65
65
|
```
|
66
66
|
|
67
|
+
```C#
|
68
|
+
|
69
|
+
using System.Collections;
|
70
|
+
|
71
|
+
using System.Collections.Generic;
|
72
|
+
|
73
|
+
using UnityEngine;
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
public class CubeA : MonoBehaviour {
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
int acd = 0;
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
// Use this for initialization
|
86
|
+
|
87
|
+
void Start()
|
88
|
+
|
89
|
+
{
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
// Update is called once per frame
|
98
|
+
|
99
|
+
void Update()
|
100
|
+
|
101
|
+
{
|
102
|
+
|
103
|
+
if (acd == 1)
|
104
|
+
|
105
|
+
{
|
106
|
+
|
107
|
+
transform.Rotate(new Vector3(0, 90, 0) * Time.deltaTime, Space.World);
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
}else if(acd == 2){
|
114
|
+
|
115
|
+
transform.position = transform.position + new Vector3(0, 10, 0);
|
116
|
+
|
117
|
+
}
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
public void CubeStrt()
|
126
|
+
|
127
|
+
{
|
128
|
+
|
129
|
+
if (acd == 0)
|
130
|
+
|
131
|
+
{
|
132
|
+
|
133
|
+
this.acd = 2;
|
134
|
+
|
135
|
+
Invoke("DelayMethod", 0.01f);
|
136
|
+
|
137
|
+
}
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
void DelayMethod()
|
142
|
+
|
143
|
+
{
|
144
|
+
|
145
|
+
this.acd = 1;
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
}
|
152
|
+
|
153
|
+
```
|
154
|
+
|
67
155
|
エラー内容
|
68
156
|
|
69
157
|
NullReferenceException: Object reference not set to an instance of an object
|
8
脱字
test
CHANGED
File without changes
|
test
CHANGED
@@ -38,23 +38,25 @@
|
|
38
38
|
|
39
39
|
public class Move : MonoBehaviour {
|
40
40
|
|
41
|
+
Animator _anim;
|
42
|
+
|
41
43
|
|
42
44
|
|
43
45
|
void Start ()
|
44
46
|
|
45
47
|
{
|
46
48
|
|
47
|
-
this.GetComponent<Animator>()
|
49
|
+
_anim = this.GetComponent<Animator>();
|
48
50
|
|
49
51
|
}
|
50
52
|
|
51
|
-
|
52
53
|
|
54
|
+
|
53
|
-
public void
|
55
|
+
public void OnButton()
|
54
56
|
|
55
57
|
{
|
56
58
|
|
57
|
-
|
59
|
+
_anim.Play("NewAnimator", 0, 0.0f);
|
58
60
|
|
59
61
|
}
|
60
62
|
|
7
画像の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
|
5
5
|
ご教授お願いします。
|
6
6
|
|
7
|
-
以下コードです
|
7
|
+
以下コードです **画像貼り直しました**
|
8
8
|
|
9
|
-
![イメージ説明](
|
9
|
+
![イメージ説明](9b597a845edae688e4408f15edc01bf8.png)
|
10
10
|
|
11
|
-
|
11
|
+
![イメージ説明](21714ad2f3b58bd52e0e08d5533eaa24.png)
|
12
12
|
|
13
13
|
```C#
|
14
14
|
|
6
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
ボタンを押すとイメージに付いているアニメーションの速度が10になるコードです。
|
2
2
|
|
3
|
-
|
3
|
+
うまくメソッドを呼び出せません。
|
4
4
|
|
5
5
|
ご教授お願いします。
|
6
6
|
|
5
不要な行の修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
ボタンを押したらアニメーションを動かす
|
test
CHANGED
@@ -8,59 +8,7 @@
|
|
8
8
|
|
9
9
|
![イメージ説明](17ea588eab47739ab275fa952616691e.png)
|
10
10
|
|
11
|
-
```C#
|
12
11
|
|
13
|
-
〜省略〜
|
14
|
-
|
15
|
-
public class NewBehaviourScript1 : MonoBehaviour {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
public void OnButton()
|
20
|
-
|
21
|
-
{
|
22
|
-
|
23
|
-
NewBehaviourScript.StretButton();
|
24
|
-
|
25
|
-
}
|
26
|
-
|
27
|
-
}
|
28
|
-
|
29
|
-
```
|
30
|
-
|
31
|
-
```C#
|
32
|
-
|
33
|
-
〜省略〜
|
34
|
-
|
35
|
-
public class NewBehaviourScript : MonoBehaviour {
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
void Start () {
|
40
|
-
|
41
|
-
this.GetComponent<Animator>().speed = 0;
|
42
|
-
|
43
|
-
}
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
public static void StretButton()
|
48
|
-
|
49
|
-
{
|
50
|
-
|
51
|
-
this.GetComponent<Animator>().speed = 10;
|
52
|
-
|
53
|
-
}
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
}
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
```
|
62
|
-
|
63
|
-
ソース修正しました 一応this.エラーは消えました。
|
64
12
|
|
65
13
|
```C#
|
66
14
|
|
4
リネーム
test
CHANGED
File without changes
|
test
CHANGED
@@ -64,7 +64,7 @@
|
|
64
64
|
|
65
65
|
```C#
|
66
66
|
|
67
|
-
public class
|
67
|
+
public class GameManager : MonoBehaviour
|
68
68
|
|
69
69
|
{
|
70
70
|
|
3
追記2
test
CHANGED
File without changes
|
test
CHANGED
@@ -64,9 +64,11 @@
|
|
64
64
|
|
65
65
|
```C#
|
66
66
|
|
67
|
-
public class
|
67
|
+
public class StartButton : MonoBehaviour
|
68
68
|
|
69
|
+
{
|
70
|
+
|
69
|
-
[SerializeField]
|
71
|
+
[SerializeField] Move _k;
|
70
72
|
|
71
73
|
|
72
74
|
|
@@ -74,7 +76,9 @@
|
|
74
76
|
|
75
77
|
{
|
76
78
|
|
79
|
+
Debug.Log("ok");
|
80
|
+
|
77
|
-
_k.
|
81
|
+
_k.MoveButton();
|
78
82
|
|
79
83
|
}
|
80
84
|
|
@@ -84,7 +88,7 @@
|
|
84
88
|
|
85
89
|
```C#
|
86
90
|
|
87
|
-
public class
|
91
|
+
public class Move : MonoBehaviour {
|
88
92
|
|
89
93
|
|
90
94
|
|
@@ -98,7 +102,7 @@
|
|
98
102
|
|
99
103
|
|
100
104
|
|
101
|
-
public void
|
105
|
+
public void MoveButton()
|
102
106
|
|
103
107
|
{
|
104
108
|
|
@@ -106,8 +110,16 @@
|
|
106
110
|
|
107
111
|
}
|
108
112
|
|
109
|
-
|
110
|
-
|
111
113
|
}
|
112
114
|
|
113
115
|
```
|
116
|
+
|
117
|
+
エラー内容
|
118
|
+
|
119
|
+
NullReferenceException: Object reference not set to an instance of an object
|
120
|
+
|
121
|
+
StartButton.OnButton () (at Assets/StartButton.cs:12)
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
NullReferenceException:オブジェクト参照がオブジェクトのインスタンスに設定されていない
|
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -59,3 +59,55 @@
|
|
59
59
|
|
60
60
|
|
61
61
|
```
|
62
|
+
|
63
|
+
ソース修正しました 一応this.エラーは消えました。
|
64
|
+
|
65
|
+
```C#
|
66
|
+
|
67
|
+
public class NewBehaviourScript1 : MonoBehaviour {
|
68
|
+
|
69
|
+
[SerializeField] NewBehaviourScript _k;
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
public void OnButton()
|
74
|
+
|
75
|
+
{
|
76
|
+
|
77
|
+
_k.StretButton();
|
78
|
+
|
79
|
+
}
|
80
|
+
|
81
|
+
}
|
82
|
+
|
83
|
+
```
|
84
|
+
|
85
|
+
```C#
|
86
|
+
|
87
|
+
public class NewBehaviourScript : MonoBehaviour {
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
void Start ()
|
92
|
+
|
93
|
+
{
|
94
|
+
|
95
|
+
this.GetComponent<Animator>().speed = 0;
|
96
|
+
|
97
|
+
}
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
public void StretButton()
|
102
|
+
|
103
|
+
{
|
104
|
+
|
105
|
+
this.GetComponent<Animator>().speed = 10;
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
```
|
1
不要な行省略
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,13 +10,7 @@
|
|
10
10
|
|
11
11
|
```C#
|
12
12
|
|
13
|
-
using System.Collections;
|
14
|
-
|
15
|
-
using System.Collections.Generic;
|
16
|
-
|
17
|
-
|
13
|
+
〜省略〜
|
18
|
-
|
19
|
-
|
20
14
|
|
21
15
|
public class NewBehaviourScript1 : MonoBehaviour {
|
22
16
|
|
@@ -36,13 +30,7 @@
|
|
36
30
|
|
37
31
|
```C#
|
38
32
|
|
39
|
-
using System.Collections;
|
40
|
-
|
41
|
-
using System.Collections.Generic;
|
42
|
-
|
43
|
-
|
33
|
+
〜省略〜
|
44
|
-
|
45
|
-
|
46
34
|
|
47
35
|
public class NewBehaviourScript : MonoBehaviour {
|
48
36
|
|