質問編集履歴
6
えい
test
CHANGED
File without changes
|
test
CHANGED
@@ -591,3 +591,9 @@
|
|
591
591
|
ご親切な方、処理の書き方を教えてもらえませんか?
|
592
592
|
|
593
593
|
回答お願いします。
|
594
|
+
|
595
|
+
|
596
|
+
|
597
|
+
やった事
|
598
|
+
|
599
|
+
AnimationのRigなどをいじりましたが、攻撃してきません。主人公キャラも右手を挙げています
|
5
おういえす
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Unityのサイトを見ながらゲームを作っているのですが、敵が
|
1
|
+
Unityのサイトを見ながらゲームを作っているのですが、敵が主人公に攻撃しません
|
test
CHANGED
@@ -1,42 +1,512 @@
|
|
1
|
-
**敵キャラクター
|
1
|
+
**敵キャラクターが攻撃してくれません**
|
2
2
|
|
3
3
|
↓参考にさせていただいているサイト
|
4
4
|
|
5
5
|
https://gametukurikata.com/program/attacknear
|
6
6
|
|
7
|
-
**↓
|
7
|
+
**↓敵のスクリプトです**
|
8
8
|
|
9
9
|
```C#
|
10
10
|
|
11
|
+
using UnityEngine;
|
12
|
+
|
11
13
|
using System.Collections;
|
12
14
|
|
15
|
+
using UnityEngine.AI;
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
public class Enemy : MonoBehaviour
|
20
|
+
|
21
|
+
{
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
public enum EnemyState
|
26
|
+
|
27
|
+
{
|
28
|
+
|
29
|
+
Walk,
|
30
|
+
|
31
|
+
Wait,
|
32
|
+
|
33
|
+
Chase,
|
34
|
+
|
35
|
+
Attack,
|
36
|
+
|
37
|
+
Freeze
|
38
|
+
|
39
|
+
};
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
#region プレイべーと変数
|
44
|
+
|
45
|
+
private CharacterController enemyController;
|
46
|
+
|
47
|
+
private Animator animator;
|
48
|
+
|
49
|
+
// 目的地
|
50
|
+
|
51
|
+
private Vector3 destination;
|
52
|
+
|
53
|
+
// 歩くスピード
|
54
|
+
|
55
|
+
[SerializeField]
|
56
|
+
|
57
|
+
private float walkSpeed = 1.0f;
|
58
|
+
|
59
|
+
// 速度
|
60
|
+
|
61
|
+
private Vector3 velocity;
|
62
|
+
|
63
|
+
// 移動方向
|
64
|
+
|
65
|
+
private Vector3 direction;
|
66
|
+
|
67
|
+
// 到着フラグ
|
68
|
+
|
69
|
+
private bool arrived;
|
70
|
+
|
71
|
+
// SetPositionスクリプト
|
72
|
+
|
13
|
-
|
73
|
+
private SetPosition setPosition;
|
74
|
+
|
75
|
+
// 待ち時間
|
76
|
+
|
77
|
+
[SerializeField]
|
78
|
+
|
79
|
+
private float waitTime = 5f;
|
80
|
+
|
81
|
+
// 経過時間
|
82
|
+
|
83
|
+
private float elapsedTime;
|
84
|
+
|
85
|
+
// 敵の状態
|
86
|
+
|
87
|
+
private EnemyState state;
|
88
|
+
|
89
|
+
// 追いかけるキャラクター
|
90
|
+
|
91
|
+
private Transform playerTransform;
|
92
|
+
|
93
|
+
// エージェント
|
94
|
+
|
95
|
+
private NavMeshAgent navMeshAgent;
|
96
|
+
|
97
|
+
// 回転スピード
|
98
|
+
|
99
|
+
[SerializeField]
|
100
|
+
|
101
|
+
private float rotateSpeed;
|
102
|
+
|
103
|
+
// 攻撃した後のフリーズ状態
|
104
|
+
|
105
|
+
[SerializeField]
|
106
|
+
|
107
|
+
private float freezeTime = 0.5f;
|
108
|
+
|
109
|
+
#endregion
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
// Use this for initialization
|
114
|
+
|
115
|
+
void Start()
|
116
|
+
|
117
|
+
{
|
118
|
+
|
119
|
+
navMeshAgent = GetComponent<NavMeshAgent>();
|
120
|
+
|
121
|
+
enemyController = GetComponent<CharacterController>();
|
122
|
+
|
123
|
+
animator = GetComponent<Animator>();
|
124
|
+
|
125
|
+
setPosition = GetComponent<SetPosition>();
|
126
|
+
|
127
|
+
setPosition.CreateRondomPosition();
|
128
|
+
|
129
|
+
destination = setPosition.GetDestination();
|
130
|
+
|
131
|
+
velocity = Vector3.zero;
|
132
|
+
|
133
|
+
arrived = false;
|
134
|
+
|
135
|
+
elapsedTime = 0f;
|
136
|
+
|
137
|
+
SetState(EnemyState.Walk);
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
// Update is called once per frame
|
144
|
+
|
145
|
+
void Update()
|
146
|
+
|
147
|
+
{
|
148
|
+
|
149
|
+
// 見回りまたはキャラクターを追いかける状態
|
150
|
+
|
151
|
+
if (state == EnemyState.Walk || state == EnemyState.Chase)
|
152
|
+
|
153
|
+
{
|
154
|
+
|
155
|
+
// キャラクターを追いかける状態であればキャラクターの目的地を再設定
|
156
|
+
|
157
|
+
if (state == EnemyState.Chase)
|
158
|
+
|
159
|
+
{
|
160
|
+
|
161
|
+
setPosition.SetDestination(playerTransform.position);
|
162
|
+
|
163
|
+
}
|
164
|
+
|
165
|
+
if (enemyController.isGrounded)
|
166
|
+
|
167
|
+
{
|
168
|
+
|
169
|
+
velocity = Vector3.zero;
|
170
|
+
|
171
|
+
animator.SetFloat("Speed", 2.0f);
|
172
|
+
|
173
|
+
direction = (setPosition.GetDestination() - transform.position).normalized;
|
174
|
+
|
175
|
+
transform.LookAt(new Vector3(setPosition.GetDestination().x, transform.position.y, setPosition.GetDestination().z));
|
176
|
+
|
177
|
+
velocity = direction * walkSpeed;
|
178
|
+
|
179
|
+
}
|
180
|
+
|
181
|
+
if (state == EnemyState.Walk)
|
182
|
+
|
183
|
+
{
|
184
|
+
|
185
|
+
// 目的地に到着したかどうかの判定
|
186
|
+
|
187
|
+
if (Vector3.Distance(transform.position, setPosition.GetDestination()) < 0.7f)
|
188
|
+
|
189
|
+
{
|
190
|
+
|
191
|
+
SetState(EnemyState.Wait);
|
192
|
+
|
193
|
+
animator.SetFloat("Speed", 0.0f);
|
194
|
+
|
195
|
+
}
|
196
|
+
|
197
|
+
}
|
198
|
+
|
199
|
+
else if(state == EnemyState.Walk)
|
200
|
+
|
201
|
+
{
|
202
|
+
|
203
|
+
// 攻撃する距離だったら攻撃
|
204
|
+
|
205
|
+
if(Vector3.Distance(transform.position,setPosition.GetDestination()) < 1f)
|
206
|
+
|
207
|
+
{
|
208
|
+
|
209
|
+
SetState(EnemyState.Attack);
|
210
|
+
|
211
|
+
}
|
212
|
+
|
213
|
+
}
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
}// 到着していたら一定時間待つ
|
218
|
+
|
219
|
+
else if (state == EnemyState.Wait)
|
220
|
+
|
221
|
+
{
|
222
|
+
|
223
|
+
elapsedTime += Time.deltaTime;
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
// 待ち時間を越えたら次の目的地を設定
|
228
|
+
|
229
|
+
if (elapsedTime > waitTime)
|
230
|
+
|
231
|
+
{
|
232
|
+
|
233
|
+
SetState(EnemyState.Walk);
|
234
|
+
|
235
|
+
}
|
236
|
+
|
237
|
+
}
|
238
|
+
|
239
|
+
// 攻撃後のフリーズ状態
|
240
|
+
|
241
|
+
else if(state == EnemyState.Freeze)
|
242
|
+
|
243
|
+
{
|
244
|
+
|
245
|
+
elapsedTime += Time.deltaTime;
|
246
|
+
|
247
|
+
if(elapsedTime > freezeTime)
|
248
|
+
|
249
|
+
{
|
250
|
+
|
251
|
+
SetState(EnemyState.Walk);
|
252
|
+
|
253
|
+
}
|
254
|
+
|
255
|
+
}
|
256
|
+
|
257
|
+
velocity.y += Physics.gravity.y * Time.deltaTime;
|
258
|
+
|
259
|
+
enemyController.Move(velocity * Time.deltaTime);
|
260
|
+
|
261
|
+
}
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
//if(state == EnemyState.Dead)
|
266
|
+
|
267
|
+
//{
|
268
|
+
|
269
|
+
// return;
|
270
|
+
|
271
|
+
//}
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
// if (!arrived)
|
276
|
+
|
277
|
+
// {
|
278
|
+
|
279
|
+
// if (enemyController.isGrounded)
|
280
|
+
|
281
|
+
// {
|
282
|
+
|
283
|
+
// velocity = Vector3.zero;
|
284
|
+
|
285
|
+
// animator.SetFloat("Speed", 2.0f);
|
286
|
+
|
287
|
+
// direction = (destination - transform.position).normalized;
|
288
|
+
|
289
|
+
// transform.LookAt(new Vector3(destination.x, transform.position.y, destination.z));
|
290
|
+
|
291
|
+
// velocity = direction * walkSpeed;
|
292
|
+
|
293
|
+
// Debug.Log(destination);
|
294
|
+
|
295
|
+
// }
|
296
|
+
|
297
|
+
// velocity.y += Physics.gravity.y * Time.deltaTime;
|
298
|
+
|
299
|
+
// enemyController.Move(velocity * Time.deltaTime);
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
// // 目的地に到着したかどうかの判定
|
304
|
+
|
305
|
+
// if (Vector3.Distance(transform.position, destination) < 0.5f)
|
306
|
+
|
307
|
+
// {
|
308
|
+
|
309
|
+
// arrived = true;
|
310
|
+
|
311
|
+
// animator.SetFloat("Speed", 0.0f);
|
312
|
+
|
313
|
+
// }
|
314
|
+
|
315
|
+
// // 到着していたら
|
316
|
+
|
317
|
+
// }
|
318
|
+
|
319
|
+
// else
|
320
|
+
|
321
|
+
// {
|
322
|
+
|
323
|
+
// elapsedTime += Time.deltaTime;
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
// // 待ち時間を越えたら次の目的地を設定
|
328
|
+
|
329
|
+
// if (elapsedTime > waitTime)
|
330
|
+
|
331
|
+
// {
|
332
|
+
|
333
|
+
// setPosition.CreateRondomPosition();
|
334
|
+
|
335
|
+
// destination = setPosition.GetDestination();
|
336
|
+
|
337
|
+
// arrived = false;
|
338
|
+
|
339
|
+
// elapsedTime = 0f;
|
340
|
+
|
341
|
+
// }
|
342
|
+
|
343
|
+
// Debug.Log(elapsedTime);
|
344
|
+
|
345
|
+
// }
|
346
|
+
|
347
|
+
public void SetState(EnemyState tempState, Transform targetObj = null)
|
348
|
+
|
349
|
+
{
|
350
|
+
|
351
|
+
if (tempState == EnemyState.Walk)
|
352
|
+
|
353
|
+
{
|
354
|
+
|
355
|
+
arrived = false;
|
356
|
+
|
357
|
+
elapsedTime = 0f;
|
358
|
+
|
359
|
+
state = tempState;
|
360
|
+
|
361
|
+
setPosition.CreateRondomPosition();
|
362
|
+
|
363
|
+
}
|
364
|
+
|
365
|
+
else if (tempState == EnemyState.Chase)
|
366
|
+
|
367
|
+
{
|
368
|
+
|
369
|
+
state = tempState;
|
370
|
+
|
371
|
+
// 待機状態から追いかける場合もあるのでOFF
|
372
|
+
|
373
|
+
arrived = false;
|
374
|
+
|
375
|
+
// 追いかける対象をセット
|
376
|
+
|
377
|
+
playerTransform = targetObj;
|
378
|
+
|
379
|
+
}
|
380
|
+
|
381
|
+
else if (tempState == EnemyState.Wait)
|
382
|
+
|
383
|
+
{
|
384
|
+
|
385
|
+
elapsedTime = 0f;
|
386
|
+
|
387
|
+
state = tempState;
|
388
|
+
|
389
|
+
arrived = true;
|
390
|
+
|
391
|
+
velocity = Vector3.zero;
|
392
|
+
|
393
|
+
animator.SetFloat("Speed", 0f);
|
394
|
+
|
395
|
+
}
|
396
|
+
|
397
|
+
else if(tempState == EnemyState.Attack)
|
398
|
+
|
399
|
+
{
|
400
|
+
|
401
|
+
velocity = Vector3.zero;
|
402
|
+
|
403
|
+
animator.SetFloat("Speed", 0f);
|
404
|
+
|
405
|
+
animator.SetBool("Attack", true);
|
406
|
+
|
407
|
+
}
|
408
|
+
|
409
|
+
else if(tempState == EnemyState.Freeze)
|
410
|
+
|
411
|
+
{
|
412
|
+
|
413
|
+
elapsedTime = 0f;
|
414
|
+
|
415
|
+
velocity = Vector3.zero;
|
416
|
+
|
417
|
+
animator.SetFloat("Speed", 0f);
|
418
|
+
|
419
|
+
animator.SetBool("Attack", false);
|
420
|
+
|
421
|
+
}
|
422
|
+
|
423
|
+
}
|
424
|
+
|
425
|
+
// 敵キャラクターの状態取得メソッド
|
426
|
+
|
427
|
+
public EnemyState GetState()
|
428
|
+
|
429
|
+
{
|
430
|
+
|
431
|
+
return state;
|
432
|
+
|
433
|
+
}
|
434
|
+
|
435
|
+
}
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
```
|
444
|
+
|
445
|
+
**Unity上でのエラー**
|
446
|
+
|
447
|
+
なし
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
**プレイヤーのスクリプト**
|
462
|
+
|
463
|
+
```C#
|
14
464
|
|
15
465
|
using UnityEngine;
|
16
466
|
|
17
|
-
|
467
|
+
using System.Collections;
|
18
|
-
|
468
|
+
|
469
|
+
|
470
|
+
|
19
|
-
public class
|
471
|
+
public class Move : MonoBehaviour
|
20
472
|
|
21
473
|
{
|
22
474
|
|
23
|
-
|
475
|
+
public enum MyState
|
476
|
+
|
24
|
-
|
477
|
+
{
|
478
|
+
|
479
|
+
Normal,
|
480
|
+
|
481
|
+
Damage
|
482
|
+
|
483
|
+
};
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
private MyState state;
|
488
|
+
|
489
|
+
private CharacterController characterController;
|
490
|
+
|
25
|
-
private
|
491
|
+
private Vector3 velocity;
|
492
|
+
|
26
|
-
|
493
|
+
[SerializeField]
|
494
|
+
|
27
|
-
|
495
|
+
private float walkSpeed;
|
496
|
+
|
28
|
-
|
497
|
+
private Animator animator;
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
498
|
+
|
499
|
+
|
500
|
+
|
33
|
-
//
|
501
|
+
// Use this for initialization
|
34
502
|
|
35
503
|
void Start()
|
36
504
|
|
37
505
|
{
|
38
506
|
|
507
|
+
characterController = GetComponent<CharacterController>();
|
508
|
+
|
39
|
-
|
509
|
+
animator = GetComponent<Animator>();
|
40
510
|
|
41
511
|
}
|
42
512
|
|
@@ -48,181 +518,71 @@
|
|
48
518
|
|
49
519
|
{
|
50
520
|
|
51
|
-
|
521
|
+
if (state == MyState.Normal)
|
522
|
+
|
52
|
-
|
523
|
+
{ // 地面に設置してるときは速度を初期化
|
524
|
+
|
525
|
+
if (characterController.isGrounded)
|
526
|
+
|
527
|
+
{
|
528
|
+
|
529
|
+
velocity = Vector3.zero;
|
530
|
+
|
531
|
+
var input = new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical"));
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
if (input.magnitude > 0.1f)
|
536
|
+
|
537
|
+
{
|
538
|
+
|
539
|
+
animator.SetFloat("Speed", input.magnitude);
|
540
|
+
|
541
|
+
transform.LookAt(transform.position + input);
|
542
|
+
|
543
|
+
velocity += input.normalized * walkSpeed;
|
544
|
+
|
53
|
-
}
|
545
|
+
}
|
54
|
-
|
55
|
-
|
56
|
-
|
546
|
+
|
57
|
-
|
547
|
+
else
|
58
|
-
|
548
|
+
|
59
|
-
{
|
549
|
+
{
|
60
|
-
|
550
|
+
|
61
|
-
|
551
|
+
animator.SetFloat("Speed", 0f);
|
62
|
-
|
552
|
+
|
63
|
-
}
|
553
|
+
}
|
554
|
+
|
64
|
-
|
555
|
+
}
|
556
|
+
|
65
|
-
|
557
|
+
}
|
558
|
+
|
559
|
+
velocity.y += Physics.gravity.y * Time.deltaTime;
|
560
|
+
|
561
|
+
characterController.Move(velocity * Time.deltaTime);
|
562
|
+
|
563
|
+
}
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
public void TakeDamage(Transform enemyTransform)
|
568
|
+
|
569
|
+
{
|
570
|
+
|
571
|
+
state = MyState.Damage;
|
572
|
+
|
573
|
+
velocity = Vector3.zero;
|
574
|
+
|
575
|
+
animator.SetTrigger("Damage");
|
576
|
+
|
577
|
+
// characterController.Move(enemyTransform.forward * 0.5f);
|
578
|
+
|
579
|
+
}
|
66
580
|
|
67
581
|
}
|
68
582
|
|
69
|
-
|
70
|
-
|
71
583
|
```
|
72
584
|
|
73
|
-
|
74
|
-
|
75
|
-
NullReferenceException: Object reference not set to an instance of an object
|
76
|
-
|
77
|
-
UnityEditor.Graphs.Edge.WakeUp () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Edge.cs:114)
|
78
|
-
|
79
|
-
UnityEditor.Graphs.Graph.DoWakeUpEdges (System.Collections.Generic.List`1[T] inEdges, System.Collections.Generic.List`1[T] ok, System.Collections.Generic.List`1[T] error, System.Boolean inEdgesUsedToBeValid) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:387)
|
80
|
-
|
81
|
-
UnityEditor.Graphs.Graph.WakeUpEdges (System.Boolean clearSlotEdges) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:286)
|
82
|
-
|
83
|
-
UnityEditor.Graphs.Graph.WakeUp (System.Boolean force) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:272)
|
84
|
-
|
85
|
-
UnityEditor.Graphs.Graph.WakeUp () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:250)
|
86
|
-
|
87
|
-
UnityEditor.Graphs.Graph.OnEnable () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:245)
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
**プレイヤーのスクリプト**
|
102
|
-
|
103
|
-
```C#
|
104
|
-
|
105
|
-
using UnityEngine;
|
106
|
-
|
107
|
-
using System.Collections;
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
public class Move : MonoBehaviour
|
112
|
-
|
113
|
-
{
|
114
|
-
|
115
|
-
public enum MyState
|
116
|
-
|
117
|
-
{
|
118
|
-
|
119
|
-
Normal,
|
120
|
-
|
121
|
-
Damage
|
122
|
-
|
123
|
-
};
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
private MyState state;
|
128
|
-
|
129
|
-
private CharacterController characterController;
|
130
|
-
|
131
|
-
private Vector3 velocity;
|
132
|
-
|
133
|
-
[SerializeField]
|
134
|
-
|
135
|
-
private float walkSpeed;
|
136
|
-
|
137
|
-
private Animator animator;
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
// Use this for initialization
|
142
|
-
|
143
|
-
void Start()
|
144
|
-
|
145
|
-
{
|
146
|
-
|
147
|
-
characterController = GetComponent<CharacterController>();
|
148
|
-
|
149
|
-
animator = GetComponent<Animator>();
|
150
|
-
|
151
|
-
}
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
// Update is called once per frame
|
156
|
-
|
157
|
-
void Update()
|
158
|
-
|
159
|
-
{
|
160
|
-
|
161
|
-
if (state == MyState.Normal)
|
162
|
-
|
163
|
-
{ // 地面に設置してるときは速度を初期化
|
164
|
-
|
165
|
-
if (characterController.isGrounded)
|
166
|
-
|
167
|
-
{
|
168
|
-
|
169
|
-
velocity = Vector3.zero;
|
170
|
-
|
171
|
-
var input = new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical"));
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
if (input.magnitude > 0.1f)
|
176
|
-
|
177
|
-
{
|
178
|
-
|
179
|
-
animator.SetFloat("Speed", input.magnitude);
|
180
|
-
|
181
|
-
transform.LookAt(transform.position + input);
|
182
|
-
|
183
|
-
velocity += input.normalized * walkSpeed;
|
184
|
-
|
185
|
-
}
|
186
|
-
|
187
|
-
else
|
188
|
-
|
189
|
-
{
|
190
|
-
|
191
|
-
animator.SetFloat("Speed", 0f);
|
192
|
-
|
193
|
-
}
|
194
|
-
|
195
|
-
}
|
196
|
-
|
197
|
-
}
|
198
|
-
|
199
|
-
velocity.y += Physics.gravity.y * Time.deltaTime;
|
200
|
-
|
201
|
-
characterController.Move(velocity * Time.deltaTime);
|
202
|
-
|
203
|
-
}
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
public void TakeDamage(Transform enemyTransform)
|
208
|
-
|
209
|
-
{
|
210
|
-
|
211
|
-
state = MyState.Damage;
|
212
|
-
|
213
|
-
velocity = Vector3.zero;
|
214
|
-
|
215
|
-
animator.SetTrigger("Damage");
|
216
|
-
|
217
|
-
// characterController.Move(enemyTransform.forward * 0.5f);
|
218
|
-
|
219
|
-
}
|
220
|
-
|
221
|
-
}
|
222
|
-
|
223
|
-
```
|
224
|
-
|
225
|
-
まだまだ初心者故、処理の書き方を調べてもわかりません。
|
585
|
+
|
226
586
|
|
227
587
|
書いてみてもエラーが取れません。
|
228
588
|
|
4
ほえ
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
**
|
1
|
+
**敵キャラクターのエラーが出てしまいました**
|
2
2
|
|
3
3
|
↓参考にさせていただいているサイト
|
4
4
|
|
3
せいや
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Unityのサイトを見ながらゲームを作っているのですが、
|
1
|
+
Unityのサイトを見ながらゲームを作っているのですが、敵が半分埋まってしまいます。
|
test
CHANGED
File without changes
|
2
era-NullReferenceException: Object reference not set to an instance of an object PlayerMove.Update (
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
**主人公キャラクターの
|
1
|
+
**主人公キャラクターのエラーが出てしまいました**
|
2
2
|
|
3
3
|
↓参考にさせていただいているサイト
|
4
4
|
|
1
ああ
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
サイトを見ながらゲームを作っているのですが、
|
1
|
+
Unityのサイトを見ながらゲームを作っているのですが、エラーが出てしまいました
|
test
CHANGED
@@ -72,11 +72,23 @@
|
|
72
72
|
|
73
73
|
**Unity上でのエラー**
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
75
|
+
NullReferenceException: Object reference not set to an instance of an object
|
76
|
+
|
77
|
+
UnityEditor.Graphs.Edge.WakeUp () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Edge.cs:114)
|
78
|
+
|
79
|
+
UnityEditor.Graphs.Graph.DoWakeUpEdges (System.Collections.Generic.List`1[T] inEdges, System.Collections.Generic.List`1[T] ok, System.Collections.Generic.List`1[T] error, System.Boolean inEdgesUsedToBeValid) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:387)
|
80
|
+
|
81
|
+
UnityEditor.Graphs.Graph.WakeUpEdges (System.Boolean clearSlotEdges) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:286)
|
82
|
+
|
83
|
+
UnityEditor.Graphs.Graph.WakeUp (System.Boolean force) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:272)
|
84
|
+
|
85
|
+
UnityEditor.Graphs.Graph.WakeUp () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:250)
|
86
|
+
|
87
|
+
UnityEditor.Graphs.Graph.OnEnable () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:245)
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
80
92
|
|
81
93
|
|
82
94
|
|