Coder Social home page Coder Social logo

Comments (15)

dentedpixel avatar dentedpixel commented on August 17, 2024 2

Ok, thank you for all the convincing arguments, I can see your point now.

It would just be nice to include it in a way that won't break all current projects (force everyone to add the namespace to every file that uses it to get their projects working again).

I think I might look into a LeanTween Preferences editor script that would toggle on the namespace attribute... this way I could leave it up to the user.

from leantween.

colinmacleod avatar colinmacleod commented on August 17, 2024 1

PS: check out InAudio 2 to see what I mean. Create a blank Unity project, import all of InAudio 2 and then import all of LeanTween.
If you wrap the LeanTween classes in a namespace, all those errors disappear.

from leantween.

skinkwork avatar skinkwork commented on August 17, 2024 1

Full disclosure: I'm currently not using LeanTween due to expanded client/project animation requirements.

I suggested the use of a namespace mainly because I was using a separate tweening library that also had a "TweenAction" entity and it was frustrating to have to qualify which entity I was referring to every time it was used in code. I also suggested the use of a namespace to improve the professionalism of LeanTween: if I come across a library that does not conform to the basic best practices of its language then that raises a red flag, no matter the quality of the code.

I would like to avoid it just as a convenience thing, for every time you want to use LeanTween you would have to declare the namespace at the top of your file, which can be annoying.

That's a personal preference, but given that even the smallest of projects which uses LeanTween will almost certainly include other third party libraries, or even other Unity / Mono namespaces, it is surely not much of a burden to add another line at the top. Personally, I much rather having control over what is imported in each of my script files.

In the end it is your project and your choise - hence my [Suggestion] prefix. LeanTween is a very impressive library either way and thank you for all your work.

from leantween.

colinmacleod avatar colinmacleod commented on August 17, 2024 1

Sounds like a great solution.

By the way, I'd also like to underline idlepixel's closing comment - I wish I'd had his grace to say this earlier. LeanTween is a truly wonderful thing and I have used it to replace iTween in my projects. Thank you so much for sharing it.

from leantween.

skinkwork avatar skinkwork commented on August 17, 2024 1

I think I might look into a LeanTween Preferences editor script that would toggle on the namespace attribute... this way I could leave it up to the user.

A final suggestion: You could add a namespace when you release version 3.00 of the library, along with any other breaking changes you need to make.

from leantween.

colinmacleod avatar colinmacleod commented on August 17, 2024

^^^ What idlepixel said ^^^
Using a namespace will make LeanTween play nicer with other assets, esp. InAudio

from leantween.

dentedpixel avatar dentedpixel commented on August 17, 2024

I am not sure how this would help? Is this because other frameworks are using the class LeanTween or LTDescr? I somehow doubt those are very common... besides avoiding class name collision, is there some other benefit I am unaware of? I would like to avoid it just as a convenience thing, for every time you want to use LeanTween you would have to declare the namespace at the top of your file, which can be annoying.

from leantween.

colinmacleod avatar colinmacleod commented on August 17, 2024

It helps because InAudio bundles LeanTween. They have put their version inside a namespace ("InAudioLeanTween") but, unless I wrap "real" LeanTween inside a different namespace, I get a whole load of errors, presumably due to the versions being different.
As soon as I wrapped a namespace around LeanTween and then adding using to my code (using RealLeanTween, say), the incompatibility probs went away.

In other words, adding a namespace to LeanTween would allow third parties to bundle LeanTween (or parts of LeanTween) without affecting other code. The bundled LeanTween would just need to make sure it uses a unique namespace.

from leantween.

dentedpixel avatar dentedpixel commented on August 17, 2024

Hello,
I have added an editor script that you can turn on/off namespaces. If you guys could give it a spin that would be helpful. To activate find the LeanTween preferences window at Edit->LeanTween Preferences. Thanks!

from leantween.

colinmacleod avatar colinmacleod commented on August 17, 2024

Hey - apologies for the delay.

It certainly did but was a little tricky to implement.
I basically had to first remove all the LeanTween source files from the plugin folder, then comment out every LeanTween reference in my code so that the preferences item would appear. (Otherwise, I had compiler errors due to the clash with InAudio, and the preferences menu item is not built as long as there are compiler errors.) After that, I had to copy the files back to plugins and go back and uncomment all references through my codebase back in again.

But after this it seems to be happy 👍 Thank you!

from leantween.

dentedpixel avatar dentedpixel commented on August 17, 2024

Ooof, yeah that doesn't work very well if you already have compile errors to begin with :-/. Maybe InAudio wants to add it to their own namespace, which would help.

from leantween.

colinmacleod avatar colinmacleod commented on August 17, 2024

No, the compile errors are caused by the lack of a namespace in LeanTween. The LeanTween copy has a namespace in InAudio, but because the LeanTween version doesn't it causes errors as the InAudio code picks it up first - the using in their files is ignored.

from leantween.

colinmacleod avatar colinmacleod commented on August 17, 2024

But, hey, it does work

from leantween.

colinmacleod avatar colinmacleod commented on August 17, 2024

Honestly, don't worry about it. It seems in the whole history of LeanTween only 2 people have ever pointed out the suggestion, so it's not affecting very many people and, if it does, they can find this text and will work out what to do.
I'm really pleased with how it works now - and I will be able to upgrade to any future LeanTween without breaking code.

Thanks again - and have a wonderful 2017 🥇

from leantween.

dentedpixel avatar dentedpixel commented on August 17, 2024

Ahhh ok yeah that does make sense. Thanks! Hope your 2017 is going well too 🎉

from leantween.

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.