Collisions.. ( Tiled, Unity, Tiled2Unity)


(Kaspe) #1

Im Following This Guide https://www.youtube.com/watch?v=sVCXgN5_XmY&t=263s
And In the end of his video he set up the collision. so the first thing i don’t have the file named mesh it’s something else i think the name of the sprite. I put the sorting layer to player messed around with the order in layer, my dude goes trough everything. I searched for answers i found something similar they were talking about setting up box collider for my player , but i don’t know how to do it exactly…


(Seanba) #2

Hi Kaspe, that video must be a little old. The Game Object hierarchy for exported maps is a bit different now and will something like this:

MapName
    TileLayerName
        MaterialName1 (all the tiles that use a specific texture/material)
        MaterialName2 (other tiles on another material)
        Collision (colliders using 'Default' layer)
        Collision_Type1 (colliders using 'Type1' layer)
        Collision_Type2 (colliders using 'Type2' layer)
        etc...

But it sounds like what you’re really having a problem with is setting up your player character for collision detection. That’s the kind of question that’s best asked on the Unity forums but the main gist is that your character/sprite needs to have 2D colliders on it and, a RigidBody2D component (unless you are doing raycasts by hand which likely isn’t the case). Does the series of videos you linked to above not cover that?


(Kaspe) #3

I don’t think so… Is there a video tutorial on how to do that or something?


(Seanba) #4

I just took a quick look and it looks like #8 in the series handles collisions.


(Kaspe) #5

Thanks. I was stupid, didn’t even check because I thought he already had collision on or something…