Comments (5)
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.pngWhen 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/0Bdv97jBIt 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.
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.
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.
@tivec Are you willing to share that with us?
from tiled2unity.
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)
- Error Report HOT 22
- Tileset file does not exist HOT 4
- Object reference not set as an instance while parsing layer data as Xml elements. HOT 3
- Tiled2Unity: “Object reference not set to an instance of an object” HOT 5
- After recent update: FileNotFoundException and NullReferenceException, import stalls forever
- Preview scale?
- Tiled2Unity doesn't import map with textures into Unity
- Error Finding Textures HOT 3
- Animations won't play on objects on Object Layers HOT 5
- Tiled2Unity exports only .xml and creates no prefab / Preview complains about index out of range HOT 2
- "The object you are trying to replace does not exist or is not a Prefab." HOT 6
- Unity Android and Tiled2Unity Blurred Textures Issue HOT 2
- ICustomTiledImporter not called
- Warning: Rectangle has no width/height HOT 2
- Importing map problem. Getting error missing texture HOT 4
- Issue HOT 2
- Vertex numbers in meshes changing into "Infinity" or "NaN" after export HOT 2
- After i export a map with tiled i find it on prefab HOT 1
- How do i fix these compiler errors? HOT 1
- Tiled- why does it say it cant find my files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tiled2unity.