- Home /
ERROR: why is showing red OnControllerColliderHit?
Why is my script is showing red OnControllerColliderHit? Does it have to be Javascript or is there another way I can use it as an example of using UnityEngine.UI;
Answer by Eldoir · Apr 09, 2020 at 08:31 AM
Hi,
Could you please attach an image or some code to your message so we can better see what's going on?
Anyway, I've never heard of something needing Javascript in order to run properly! :)
Answer by GraceBelt123 · Apr 09, 2020 at 01:40 PM
I've figured out a red error, it only works when it comes to
void OnControllerColliderHit(ControllerColliderHit hit)
However, I am having a problem with a using System.Collections.Generic; that is not showing blue because it did not do anything to trigger a box to be moved by a player. Also, I can't use Javascript which explains why. I used C# and my player is a character controller.
Oh, well, it seems OnControllerColliderHit(ControllerColliderHit hit) is a valid Unity callback I didn't knew about. In my first answer, I didn't even bother looking in the doc for it. Shame on me!
I've edited my first answer to remove that.
The using System.Collections.Generic is not showing blue because you don't use any method of System.Collections.Generic, so your IDE is showing it gray to indicate that you can safely remove it without breaking anything.
The main reason you would want to use System.Collections.Generic is for List and Dictionary.
I'm not sure I understand what's your problem? A using directive not showing in blue is not a problem :)
Your answer
Follow this Question
Related Questions
How to create a LIST of hit.colliders? C# 1 Answer
Please help me with Raycast 1 Answer
The Child Is Not Hovered When Passing The Parent's Collider 0 Answers
how to move the player away when it's hit 3 Answers
Problem with LineCast Bullet 1 Answer