Coder Social home page Coder Social logo

Comments (5)

Seanba avatar Seanba commented on June 22, 2024

Tivec, I think what you're asking for is to replace one PolygonCollider2D
with multiple paths with several PolygonCollider2Ds with one path each (or
an option to do one or the other). Is that correct?

I think your approach is the right one, provided you make it a custom
importer script that is done at export time instead of something performed
at runtime in the behaviour's Start method.

That way when you export your Tiled maps you will have automatically
created prefabs with all the components you need ready to go. Any other
game-specific logic you need for your maps can be set up there too.

You can read about custom import scripts here:
http://www.seanba.com/megadadadventures.html

Make sure that such custom scripts have the CustomTiledImporter attribute
and are placed in an "Editor" folder (those are common mistakes).

Best,
Sean

On Mon, Sep 14, 2015 at 8:41 AM, Tivec [email protected] wrote:

Hello!

I have this map being exported from Tiled to Unity via this tool:
http://i.imgur.com/3AL4UPP.png

When this prefab is loaded, the collider that was generated will be one of
two paths under the same game object. What I would like to see is an
option to export each of these two to separate polygons.
This would help
me out when working with something such as PolyNav2D.

Right now I solve this with a script attached to the collider that splits
it into child objects, but that's probably not the best way of doing it.
Here's the script I use: http://pastebin.com/0Bdv97jB

It splits each path in the polygon and makes a new sub object to the
collider gameobject. If this could be done as an option from Tiled2Unity,
that'd make it a lot nicer to work with :)

Thanks for a great tool, and keep up the great work!


Reply to this email directly or view it on GitHub
#18.

from tiled2unity.

tivec avatar tivec commented on June 22, 2024

I'm sorry for taking so long to respond. I solved the issue by writing a custom importer that splits the colliders into new seperate ones, and I think that it works fairly well. Thanks again for a great tool that helps production in Unity lots :)

from tiled2unity.

Seanba avatar Seanba commented on June 22, 2024

Glad it worked. Thanks, Tivec.

On Wed, Sep 23, 2015 at 2:20 PM, Tivec [email protected] wrote:

I'm sorry for taking so long to respond. I solved the issue by writing a
custom importer that splits the colliders into new seperate ones, and I
think that it works fairly well. Thanks again for a great tool that helps
production in Unity lots :)


Reply to this email directly or view it on GitHub
#18 (comment).

from tiled2unity.

aggsol avatar aggsol commented on June 22, 2024

@tivec Are you willing to share that with us?

from tiled2unity.

tivec avatar tivec commented on June 22, 2024

Of course! My script is fairly simple and should be quite easy to understand. I should also set a disclaimer: I am barely adept with C#, and there may be poorly written code in the snippet. You have been warned!

https://gist.github.com/tivec/9216ed5c30d60c4c84d8

You would have to customize it if you want to handle anything except the layer "Walls", but the idea is the same :)

from tiled2unity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.