Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

2D Layer Collision

Discussion in '2D' started by dbond89, Nov 16, 2018.

  1. dbond89

    dbond89

    Joined:
    Aug 22, 2018
    Posts:
    1
    Hey all, tried to find an answer elsewhere but I'm unsure how to phrase my question properly for Google. Working on some PCG content, and I'd like to find an easier way to get some collision set up right now. It's a PCG dungeon, which selects a random tilemap prefab Room, but we're struggling with the hallways right now.

    The specific thing I'm looking for help on, is there a way to set up Collision so that the player cant essentially go "out of bounds" from where we've placed rooms, or hallways linking them? And if yes, whats the best way to accomplish it? We do have the room walls on a separate tilemap with their own collision, this is just asking about how to control if Player steps past, onto the background.

    Terrible ascii art ahead for example (made up layer numbers):

    L2: |-Player-|
    L1: |--------Room--------| <- cant step past here
    L0: ------------------Background-----------------

    Hopefully the question makes sense, and the answer is way easier than I think it will be, thank you!
     
  2. qqqbbb

    qqqbbb

    Joined:
    Jan 13, 2016
    Posts:
    113
    Why are you not using them to prevent player from going out of bounds?