Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Sawyer1424 · Jan 29, 2020 at 11:52 AM · collidersnavmeshagent

My collisions doesn't detect the collider's tag

I am making a survival horror game and am having some issues with my AI not detecting a collider that is awoken that doesn't update the Navmesh agent with a new position. Things I have tried, rapidly reseting my colliders, using the collider stay method and playing around with my collider settings. using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI;

 public class AISearch : MonoBehaviour
 {
 public Transform target;
 public GameObject targetPlayer;
 NavMeshAgent agent;
 public Transform juke;
 public Transform juke1;
 public Transform juke2;
 public Transform juke3;
 public Transform juke4;
 public Transform juke5;
 public Transform juke6;
 public Transform juke7;
 public Transform juke8;
 public bool onOff = false;
     // Start is called before the first frame update
     void Start()
     {
         agent = GetComponent<NavMeshAgent>();
         agent.SetDestination(target.position);
     }
 
     // Update is called once per frame
     void Update()
     { 
     }
     private void OnTriggerEnter(Collider other)
     {
         if (other.gameObject.CompareTag("Player"))
         {
             Destroy(targetPlayer);
             Debug.Log("Game Over");
         }
         if (other.gameObject.CompareTag("Collision"))
         { 
         agent.SetDestination(juke.position);
         }
         if (other.gameObject.CompareTag("Collision1"))
         { 
         agent.SetDestination(juke1.position);
         }
         if (other.gameObject.CompareTag("Collision2"))
         { 
         agent.SetDestination(juke2.position);
         }
         if (other.gameObject.CompareTag("Collision3"))
         { 
         agent.SetDestination(juke3.position);
         }
         if (other.gameObject.CompareTag("Collision4"))
         { 
         agent.SetDestination(juke4.position);
         }
         if (other.gameObject.CompareTag("Collision5"))
         { 
         agent.SetDestination(juke5.position);
         }
         if (other.gameObject.CompareTag("Collision6"))
         { 
         agent.SetDestination(juke6.position);
         }
         if (other.gameObject.CompareTag("Collision7"))
         { 
         agent.SetDestination(juke7.position);
         }
         if (other.gameObject.CompareTag("Collision8"))
         { 
         agent.SetDestination(juke8.position);
         }
         if (other.gameObject.CompareTag("Sneak"))
         {
         agent.SetDestination(target.position);
         }
         if (other.gameObject.CompareTag("Run"))
         {
         agent.SetDestination(target.position);
         }
         }
Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image joker_yash96 · Jan 29, 2020 at 12:28 PM 0
Share

Are you using Colliders or Triggers?

When you use Trigger functions the colliders must be switched to triggers.

Check that may be that will help.

avatar image Sawyer1424 joker_yash96 · Jan 29, 2020 at 01:02 PM 0
Share

They are all triggers (except for the player which works fine) and because of how I have it set up they have to stay that way, I also tried setting the main enemy listener collider to a non trigger but that seemed to glitch it out even more.

avatar image joker_yash96 · Jan 30, 2020 at 05:31 AM 0
Share

If you just want to detect the collider, you can use Raycast.

avatar image Sawyer1424 joker_yash96 · Jan 30, 2020 at 12:53 PM 0
Share

Thanks for the help

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

124 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

NavMeshAgent with Collision - Need Help 1 Answer

Moving NavMeshAgent inside a Collider 2 Answers

Enemies using navmesh are bumping each other through solid objects 1 Answer

Need help with fixing position of Colliders for a Ragdoll 1 Answer

OnMouseDown not firing if character isn't touching ground 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges