Hello Guest

Author Topic: Using one prefab as the wall for an entire tilemap?  (Read 4325 times)

SalmonPunch

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Using one prefab as the wall for an entire tilemap?
« on: November 19, 2014, 03:57:28 am »
Is it possible to us a single prefab for an entire tilemap? IE the prefab would be set in the data section of every tile I want to be counted as a wall, and when created the prefab would inherit the sprite of the tile it was born from, meaning I could make anything a wall without having to create countless objects.

Is this possible?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Using one prefab as the wall for an entire tilemap?
« Reply #1 on: November 19, 2014, 10:43:27 am »
Hi,

That isn't possible at the moment. I would reconsider if you are planning on making all walls inherit from a prefab, thats almost a sure fire way to kill performance in most cases... The prefab thing is meant to be used sparingly, as it will negate the optimizations that are performed normally.

SalmonPunch

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Using one prefab as the wall for an entire tilemap?
« Reply #2 on: November 19, 2014, 06:43:40 pm »
Thank you for the quick response.

So what should I do instead to ensure that the wall tiles on the tile map are solid?

Im using the PolyNav2D asset for unity, and I've been having issues with setting the automatic meshes the tilemapper makes as obstacles for PolyNav.
« Last Edit: November 19, 2014, 08:43:25 pm by SalmonPunch »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Using one prefab as the wall for an entire tilemap?
« Reply #3 on: November 22, 2014, 10:50:13 am »
Quote
Im using the PolyNav2D asset for unity, and I've been having issues with setting the automatic meshes the tilemapper makes as obstacles for PolyNav.
Can't help there - I don't use that asset.

If its a temp bit of data you need, you could write a script that will create box colliders where you need them (you can read each index of the tilemap without touching tk2d code). You could write a script that runs through these, creates the boxes, then updates your nav stuff, then delete them when you're done with that process...