追いかけてくる敵の作成
![D88efebe 4342 45f7 95bf 0e5937922589](https://codegenius.org/uploads/slide/image/3711/d88efebe-4342-45f7-95bf-0e5937922589.jpeg)
![3028db87 abc7 4f67 ad42 2d8f2e276cb9](https://codegenius.org/uploads/slide/image/3712/3028db87-abc7-4f67-ad42-2d8f2e276cb9.jpeg)
![0fa44aad a4d7 476e 93af c73229291b6e](https://codegenius.org/uploads/slide/image/3713/0fa44aad-a4d7-476e-93af-c73229291b6e.jpeg)
![1c21f01e d728 4acb b7de b965535fc6b6](https://codegenius.org/uploads/slide/image/3714/1c21f01e-d728-4acb-b7de-b965535fc6b6.jpeg)
追いかけてくる敵
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// ★追加
using UnityEngine.AI;
public class Chase : MonoBehaviour
{
public GameObject target;
private NavMeshAgent agent;
void Start()
{
agent = GetComponent<NavMeshAgent>();
}
void Update()
{
agent.destination = target.transform.position;
}
}
![E2e07eed a53d 4eea 9095 58a1deecbe2f](https://codegenius.org/uploads/slide/image/3715/e2e07eed-a53d-4eea-9095-58a1deecbe2f.jpeg)
![9bb76d82 0c6d 4ca9 b8f1 2c8ada86eebb](https://codegenius.org/uploads/slide/image/3716/9bb76d82-0c6d-4ca9-b8f1-2c8ada86eebb.jpeg)
![E9f4e616 377f 4a87 8cb2 f882a3389bb0](https://codegenius.org/uploads/slide/image/3717/e9f4e616-377f-4a87-8cb2-f882a3389bb0.jpeg)
![41dbe49e bd77 42d0 9ca0 e722723243e0](https://codegenius.org/uploads/slide/image/3718/41dbe49e-bd77-42d0-9ca0-e722723243e0.jpeg)
![90ad7353 0506 4c94 b64a f6643f35c5f4](https://codegenius.org/uploads/slide/image/3719/90ad7353-0506-4c94-b64a-f6643f35c5f4.jpeg)
![Bcb061f6 2ffa 4d6b a72d 3f003f29019d](https://codegenius.org/uploads/slide/image/3720/bcb061f6-2ffa-4d6b-a72d-3f003f29019d.jpeg)
![Bbbe638a b5e9 4ffc bbb2 87fe86860aa7](https://codegenius.org/uploads/slide/image/3721/bbbe638a-b5e9-4ffc-bbb2-87fe86860aa7.jpeg)
![37e1e418 82cc 4c7b bb00 d3a37649344b](https://codegenius.org/uploads/slide/image/3722/37e1e418-82cc-4c7b-bb00-d3a37649344b.jpeg)
![F7f24d5e d4dd 48c4 a8c6 7f020135f19c](https://codegenius.org/uploads/slide/image/3723/f7f24d5e-d4dd-48c4-a8c6-7f020135f19c.jpeg)
![Df06e4ad b2f5 40c6 ba98 84326fd525a8](https://codegenius.org/uploads/slide/image/3724/df06e4ad-b2f5-40c6-ba98-84326fd525a8.jpeg)
![598aaccf fa0e 4422 9150 ea4717557505](https://codegenius.org/uploads/slide/image/3725/598aaccf-fa0e-4422-9150-ea4717557505.jpeg)
![Eefee5e4 baae 44c0 8bd8 3ee330b04267](https://codegenius.org/uploads/slide/image/3726/eefee5e4-baae-44c0-8bd8-3ee330b04267.jpeg)
![1ef8e8d4 56a4 424e 889a ff560692b974](https://codegenius.org/uploads/slide/image/3727/1ef8e8d4-56a4-424e-889a-ff560692b974.jpeg)
![37cfc18f 2ede 42af bcf7 cd628eff33a7](https://codegenius.org/uploads/slide/image/3728/37cfc18f-2ede-42af-bcf7-cd628eff33a7.jpeg)
![Cb5199a9 1005 490d baa3 5b3e729ae99a](https://codegenius.org/uploads/slide/image/3729/cb5199a9-1005-490d-baa3-5b3e729ae99a.jpeg)
![D66f0d82 0ea6 499a 9aa3 81d19778ac6c](https://codegenius.org/uploads/slide/image/3730/d66f0d82-0ea6-499a-9aa3-81d19778ac6c.jpeg)
![C3bb3ce7 8917 4bf5 bd22 3e3333023422](https://codegenius.org/uploads/slide/image/3731/c3bb3ce7-8917-4bf5-bd22-3e3333023422.jpeg)
![4554a695 3467 461c 8bf4 10a2a5d15b49](https://codegenius.org/uploads/slide/image/3732/4554a695-3467-461c-8bf4-10a2a5d15b49.jpeg)
![Dcf6fc8f 3709 49ee afcb 90f5de62458c](https://codegenius.org/uploads/slide/image/3733/dcf6fc8f-3709-49ee-afcb-90f5de62458c.jpeg)
![6ade1bf6 3ce9 4fbe a4d9 262d896d509c](https://codegenius.org/uploads/slide/image/3734/6ade1bf6-3ce9-4fbe-a4d9-262d896d509c.jpeg)
![269d9448 7d00 4f84 af60 65e77947c6d7](https://codegenius.org/uploads/slide/image/3735/269d9448-7d00-4f84-af60-65e77947c6d7.jpeg)
![4fb84e5a 8139 4987 af44 ead8bc196022](https://codegenius.org/uploads/slide/image/3736/4fb84e5a-8139-4987-af44-ead8bc196022.jpeg)
![Fcfc4422 d168 4c9e 9af0 af37f46444f5](https://codegenius.org/uploads/slide/image/3737/fcfc4422-d168-4c9e-9af0-af37f46444f5.jpeg)
【2019版】BallGame(全27回)
他のコースを見る![D88efebe 4342 45f7 95bf 0e5937922589](https://codegenius.org/uploads/slide/image/3711/d88efebe-4342-45f7-95bf-0e5937922589.jpeg)
![3028db87 abc7 4f67 ad42 2d8f2e276cb9](https://codegenius.org/uploads/slide/image/3712/3028db87-abc7-4f67-ad42-2d8f2e276cb9.jpeg)
![0fa44aad a4d7 476e 93af c73229291b6e](https://codegenius.org/uploads/slide/image/3713/0fa44aad-a4d7-476e-93af-c73229291b6e.jpeg)
![1c21f01e d728 4acb b7de b965535fc6b6](https://codegenius.org/uploads/slide/image/3714/1c21f01e-d728-4acb-b7de-b965535fc6b6.jpeg)
追いかけてくる敵
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// ★追加
using UnityEngine.AI;
public class Chase : MonoBehaviour
{
public GameObject target;
private NavMeshAgent agent;
void Start()
{
agent = GetComponent<NavMeshAgent>();
}
void Update()
{
agent.destination = target.transform.position;
}
}
![E2e07eed a53d 4eea 9095 58a1deecbe2f](https://codegenius.org/uploads/slide/image/3715/e2e07eed-a53d-4eea-9095-58a1deecbe2f.jpeg)
![9bb76d82 0c6d 4ca9 b8f1 2c8ada86eebb](https://codegenius.org/uploads/slide/image/3716/9bb76d82-0c6d-4ca9-b8f1-2c8ada86eebb.jpeg)
![E9f4e616 377f 4a87 8cb2 f882a3389bb0](https://codegenius.org/uploads/slide/image/3717/e9f4e616-377f-4a87-8cb2-f882a3389bb0.jpeg)
![41dbe49e bd77 42d0 9ca0 e722723243e0](https://codegenius.org/uploads/slide/image/3718/41dbe49e-bd77-42d0-9ca0-e722723243e0.jpeg)
![90ad7353 0506 4c94 b64a f6643f35c5f4](https://codegenius.org/uploads/slide/image/3719/90ad7353-0506-4c94-b64a-f6643f35c5f4.jpeg)
![Bcb061f6 2ffa 4d6b a72d 3f003f29019d](https://codegenius.org/uploads/slide/image/3720/bcb061f6-2ffa-4d6b-a72d-3f003f29019d.jpeg)
![Bbbe638a b5e9 4ffc bbb2 87fe86860aa7](https://codegenius.org/uploads/slide/image/3721/bbbe638a-b5e9-4ffc-bbb2-87fe86860aa7.jpeg)
![37e1e418 82cc 4c7b bb00 d3a37649344b](https://codegenius.org/uploads/slide/image/3722/37e1e418-82cc-4c7b-bb00-d3a37649344b.jpeg)
![F7f24d5e d4dd 48c4 a8c6 7f020135f19c](https://codegenius.org/uploads/slide/image/3723/f7f24d5e-d4dd-48c4-a8c6-7f020135f19c.jpeg)
![Df06e4ad b2f5 40c6 ba98 84326fd525a8](https://codegenius.org/uploads/slide/image/3724/df06e4ad-b2f5-40c6-ba98-84326fd525a8.jpeg)
![598aaccf fa0e 4422 9150 ea4717557505](https://codegenius.org/uploads/slide/image/3725/598aaccf-fa0e-4422-9150-ea4717557505.jpeg)
![Eefee5e4 baae 44c0 8bd8 3ee330b04267](https://codegenius.org/uploads/slide/image/3726/eefee5e4-baae-44c0-8bd8-3ee330b04267.jpeg)
![1ef8e8d4 56a4 424e 889a ff560692b974](https://codegenius.org/uploads/slide/image/3727/1ef8e8d4-56a4-424e-889a-ff560692b974.jpeg)
![37cfc18f 2ede 42af bcf7 cd628eff33a7](https://codegenius.org/uploads/slide/image/3728/37cfc18f-2ede-42af-bcf7-cd628eff33a7.jpeg)
![Cb5199a9 1005 490d baa3 5b3e729ae99a](https://codegenius.org/uploads/slide/image/3729/cb5199a9-1005-490d-baa3-5b3e729ae99a.jpeg)
![D66f0d82 0ea6 499a 9aa3 81d19778ac6c](https://codegenius.org/uploads/slide/image/3730/d66f0d82-0ea6-499a-9aa3-81d19778ac6c.jpeg)
![C3bb3ce7 8917 4bf5 bd22 3e3333023422](https://codegenius.org/uploads/slide/image/3731/c3bb3ce7-8917-4bf5-bd22-3e3333023422.jpeg)
![4554a695 3467 461c 8bf4 10a2a5d15b49](https://codegenius.org/uploads/slide/image/3732/4554a695-3467-461c-8bf4-10a2a5d15b49.jpeg)
![Dcf6fc8f 3709 49ee afcb 90f5de62458c](https://codegenius.org/uploads/slide/image/3733/dcf6fc8f-3709-49ee-afcb-90f5de62458c.jpeg)
![6ade1bf6 3ce9 4fbe a4d9 262d896d509c](https://codegenius.org/uploads/slide/image/3734/6ade1bf6-3ce9-4fbe-a4d9-262d896d509c.jpeg)
![269d9448 7d00 4f84 af60 65e77947c6d7](https://codegenius.org/uploads/slide/image/3735/269d9448-7d00-4f84-af60-65e77947c6d7.jpeg)
![4fb84e5a 8139 4987 af44 ead8bc196022](https://codegenius.org/uploads/slide/image/3736/4fb84e5a-8139-4987-af44-ead8bc196022.jpeg)
![Fcfc4422 d168 4c9e 9af0 af37f46444f5](https://codegenius.org/uploads/slide/image/3737/fcfc4422-d168-4c9e-9af0-af37f46444f5.jpeg)
追いかけてくる敵の作成