Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 ahnjinmo · Jun 30, 2021 at 08:24 AM · collidermousenavmeshinteraction

OnMouse event only works for a moment and then not working

I made a randomly walking NPC with NavMesh system and I wanted to interact with that NPC by mouse event. So I used OnMouseEnter events on it.

After I play the scene, OnMouse events works perfectly. However, it ceases to work after certain time (about 3 seconds) and does not respond to mouse events. Why is this happening? I'm using Unity 2019.4.19f1 version.

Below is link of my project package. https://drive.google.com/file/d/1wdtONaAxPrGF8GIlKDkR97bttxMxB4bw/view?usp=sharing

alt text alt text

fef.png (5.6 kB)
ezgif-4-cadea4a33a20.gif (480.0 kB)
Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Devster2020 · Jun 30, 2021 at 08:45 AM

Hello @ahnjinmo
Looking to your image attached, OnMouseEnter and OnMouseExit are called 4 times, so they respond to the inputs.. in the Console, you have "Collapse" enabled, that unify all text that are equals, so you see them only one time..

If the player don't do what you expect, I think there are errors in other scripts.

Comment
Add comment · Show 6 · Share
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 ahnjinmo · Jun 30, 2021 at 08:48 AM 0
Share

I know what you said. I cut out the gif due to size of it. You can see the whole video in this link below. As you see this, you can see that it does not respond after 4 times. https://drive.google.com/file/d/1tepbNk7we9uWmNMmUed_6I6oDTVWH3qG/view?usp=sharing

avatar image Devster2020 ahnjinmo · Jun 30, 2021 at 08:53 AM 0
Share

Ok .. from what I see, the problem does not come from the passage of time, but from the fact that the character moves. From the moment he changes position, he is no longer "hit" by the mouse .. is it possible that in the script that makes the character walk, you have disabled his collider thus preventing you from triggering the action again?

avatar image ahnjinmo Devster2020 · Jun 30, 2021 at 08:58 AM 0
Share

I guess it's just a coincidence because it responds well though it's moving as I experimented several times. Also I tried disabling him walk and stay still, but it resulted the same... It did not respond to mouse event after about 3 seconds.. so I guess the problem is something else.. :(

avatar image Vivien_Lynn · Jun 30, 2021 at 09:07 AM 0
Share

You could check if your EvenSystem gets destroyed or disabled.

avatar image Devster2020 Vivien_Lynn · Jun 30, 2021 at 09:08 AM 0
Share

Yes, this may be an additional problem that has occurred.

avatar image ahnjinmo Vivien_Lynn · Jun 30, 2021 at 09:28 AM 0
Share

I figured out that as I remove the RigidBody component of NPC, it responds normally. Hmm.. I wonder why rigidbody component causes this.

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

173 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 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

How to generate a NavMesh only with colliders? 5 Answers

How can I only instantiate if mouse over? 1 Answer

MouseOver issue with Collider on prefab 0 Answers

Verify Planes collision inside OnMouseOver of another GameObject 0 Answers

Does navmesh play nice with Rigidbodies / Colliders? 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