Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library doesn't work outside of Unity #4

Open
TheHans255 opened this issue Oct 21, 2017 · 4 comments
Open

Library doesn't work outside of Unity #4

TheHans255 opened this issue Oct 21, 2017 · 4 comments

Comments

@TheHans255
Copy link

While the README claims that this internationalization library can be used as a standalone library for other applications, the library itself uses some Unity types (UnityEngine, Debug, Text, a few others). Would it be possible to use some preprocessor directives (like #ifdef UNITY) in order to use different types?

GabLeRoux added a commit to GabLeRoux/i18n-unity-csharp that referenced this issue Oct 22, 2017
@GabLeRoux
Copy link
Collaborator

GabLeRoux commented Oct 22, 2017

Yup, you're right, I haven't tried outside of Unity, but from the current code, it can't work right now since it uses some Unity3D classes such as Debug and TextAsset.

You can give a try to my feature/remove-unity-dependency branch

I tried what you suggested here, but haven't tried the project somewhere else than inside Unity. If you'd like to give this a try, just let us know. Feel free to send a Pull-Request and instructions on how to use it outside of Unity and I'll be happy to give it a try.

@TheHans255
Copy link
Author

Thanks for doing this. However, your changes in that feature branch don't work for two reasons:

  1. UNITY_EDITOR is only defined while running inside the Editor. This means that the Unity library sections are taken out when the project is actually built. You would need a different #define that would catch all cases when Unity is used.
  2. You don't provide any #else blocks with alternate implementations - the idea is that when you're not in Unity, you would use System types to do the same thing. Right now, when not in Unity, the program actually does absolutely nothing.

@GabLeRoux
Copy link
Collaborator

GabLeRoux commented Oct 29, 2017

Sure, that was only to give you a starting point in case you would like to make it happen. I did not try to build it, but sure thing, UNITY_EDITOR is not what we're looking for here. I did not try UNITY either, maybe it works. I couldn't find it in documentation

If I had to use i18n in a non-unity .net project, I would probably go with something more common / tested such as one of these:

@camsjams
Copy link
Member

For history, it did but we had a project that was giving us trouble so I had to add it in the file as a dependency:
0be41e2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants