COLLISION 2D Detection !

preview_player
Показать описание
In this video we will learn how to detect collision 2D in Unity.
OnCollisionEnter2D,
OnCollisionStay2D, And OnCollisionExit2D...

Enjoy the video ☕

————————————————————————————
🖐 Hi Game developer
Welcome to Rehope Games I'm Murat

I share unity tutorial videos on my channel. if you want to make a game with unity (especially 2d platformer game), the videos here will definitely interest you.

✅ ⫸ new video every week ⫷
————————————————————————————

#unitytutorials, #unity2d, #unity2dplatformer
Рекомендации по теме
Комментарии
Автор

Why does the video not contain any information about the rigidbodies and colliders needed to add to the objects?
This is really confusing for newcomers. If you just do the script, nothing of this will work.
Since collision detection is a very basic function as you said yourself, you should take into account, that some people watching this video might just start out and have no clue about those components.

dasrudi
Автор

Hey I'm working on a game too! I know it's a crazy experience, especially doing everything solo! Just showing love! Best of luck to ya✊🏾✊🏾

bobbville
Автор

bro be doing one of the most basic things in unity but has music fit for hacking the pentagon. thx for the vid, the music isnt a bad thing.

louisonsad
Автор

this is the code, copy paste it:




using System.Collections;

using System.Collections.Generic;
using UnityEngine;

public class CollisionController : MonoBehaviour
{
private void collision)
{
if (collision.gameObject.name == "jesus the betrayed")
{
Debug.Log("enter");
}
}

private void OnCollisionStay2D(Collision2D collision)
{
if (collision.gameObject.name == "jesus the betrayed")
{
Debug.Log("stay");
}
}

private void OnCollisionExit2D(Collision2D collision)
{
if (collision.gameObject.name == "jesus the betrayed")
{
Debug.Log("exit");
}
}
}

Madeinchina-du
Автор

Music is HIGHLY annoying to say the least.

Johan-rmec
Автор

the music is to loud I can't hear anything

angelaplumley
Автор

the music is much to loud, the rigidbody2d (in my case topdown2d with dynamic bodytype and GravityScale =0 ) and the collider are important. nobody is perfect, go ahead

HickyGreen
Автор

I subbed. Interesting tutorials. ive gotten pretty far with my project. my style is an action platformer like megaman/Castlevania. I wanted to ask will you have a tutorial how to create a get hit by enemy and there is a bounce back? A "Knock back" effect? Kinda like how the effect looks on NES for megaman or even Castlevania? Thanks

xDTHECHEMISTx
Автор

THANKYOUUU
after like three hours of looking for a way to do it ive found it!

thechaostheorem
Автор

Hi, probably I miss some obvious step but as soon as I run the code I get problem with GameController: "type or namespace could not be found"..any hint about ?

andreamaiellaro
Автор

Do your channel a favor and don't include loud music in instructional videos. Not trying to be mean, but it's unwatchable for me.

aesp
Автор

Thank you, this is an informative video!

Tempire-kl
Автор

how u moving that wooden box I mean what component are u using ?

ASH
Автор

Hey cool but how can i add layernames to the collisons? I have apples and so on, they are fruits layer - and i have a cake, that has the layername "enemies"

gamerel
Автор

the video is interesting, the music is stressing, when you are learning something like this not ideal to have music, specially if people need to repeat the same instructions the music turns in to a nightmare.

FloraArs
Автор

Hi, Thank you very much for your video. But I have one problem. My collision does not work. Can you advise mu, what should I check, I tried everything. Thanks in advance.

spikeleon