Coder Social home page Coder Social logo

Comments (4)

Seanba avatar Seanba commented on June 22, 2024

Hi dpavon, thanks for reporting this and taking the time to track down the errant code. I've updated the source on GitHub and put up a new version to Tiled2Unity with the fix on my blog.

Good luck on your game.

from tiled2unity.

dpavon avatar dpavon commented on June 22, 2024

That was fast! Thanks a lot! (tested and it works)

By the way, I've got a suggestion, but I'm not sure if it's something too specific or if anyone else could benefit. As I said with the procedural generation, I need to load Resources prefabs in runtime:

In execution time, I will not know all the names of the resources, so I need to find them all somehow. I tried first with storing some kind of "index", like a cache or similar, but I don't like it and has some drawbacks.

The thing is, Unity has a method called LoadAll to do this that gives you the option to specify a relative path inside "Resources" folder, and all those prefabs inside would be loaded as Object[]. Right now in Tiled2Unity, all maps are imported either on Tiled2Unity/Prefabs, or in case this boolean is True, on "Tiled2Unity/Prefabs/Resources".

So, in short: could there be the possibility of using this "unity:resource" as a string, instead of a boolean, so that anyone could specify the folder where each map would be saved?

Example: 3 tmx maps with different unity:resource = [Forest, Lake, Mountain], and these maps would be imported on "Tiled2Unity/Resources/Forest/", "Tiled2Unity/Resources/Lake/", "Tiled2Unity/Resources/Mountain/" folders. At runtime, the developer would use LoadAll("Lake") to obtain only those needed.

Anyway, I'm not sure if using another property would be better, like "unity:resourcePath", because an empty (but existing) unity:resource="" might confuse users. I leave this open to suggestions.

Right now I'm modifying the output folder so I have all maps in a folder called "Tiled", so it's not something I would desperately need, but maybe someone could benefit of a change like this. I'm not sure if it is a minor or big change, so I'll just drop this idea over here.

Then again, great work, keep it up! You may consider this issue closed by my side.

from tiled2unity.

Seanba avatar Seanba commented on June 22, 2024

That's a good suggestion. I went with the unity:resourcePath approach.

You will be alerted if you use characters in your string that can't be used in a path (like '|', '<', '>', etc.).

Code and download page has been updated. Let me know if you run into any issues.

from tiled2unity.

Seanba avatar Seanba commented on June 22, 2024

Also, note that you don't have to use both unity:resource and unity:resourcePath together. In your case, using unity:resourcePath and having it set to a non-empty string will suffice. Having just unity:resource will resort to the old behavior. There's no harm in having both properties used as unity:resourcePath will take precedence.

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.