Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

TEXDraw - Create Math Expressions inside Unity!

Discussion in 'Assets and Asset Store' started by WillNode, Jan 13, 2016.

  1. L_A_R

    L_A_R

    Joined:
    May 14, 2017
    Posts:
    34
    Hi I have two problems I was hoping you could help with:

    1) In maths "1a" should be just "a", how do I hide the 1? If I used string.Replace it will hide all 1's.
    (e.g 3a -a = 2a ...that's fine but shouldn't be written as 3a-1a)

    2)How can I generate random numbers and letters from WITHIN texdraw as a function? Doing it externally is easy but doing it from within TexDraw would be so much more efficient.

    Any help pointing me in the right direction would be greatly appreciated.
     
  2. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    You can use Regex to accomplish that,

    Code (CSharp):
    1. using System.Text.RegularExpressions;
    Code (CSharp):
    1. Regex.Replace("2x + 1z = 1", @"\b1(\w+)\b", @"$1", RegexOptions.IgnoreCase);
    I think it's not worth the doing. I mean I know a lot about GC and I reuse a lot of memory to get rid of garbages during TEXDraw internal processing (not completely, only left few GC's due to string processing during parsing text, nobody can get rid of that). But anyway, nowadays GC are really efficient and not worrying about that should be my recommendation rather than you hack into TEXDraw parser and start messing up other functionalities.
     
  3. ammar_12435

    ammar_12435

    Joined:
    Jun 28, 2018
    Posts:
    24
    bump.

    Any help?
     
  4. accforaus

    accforaus

    Joined:
    Feb 12, 2019
    Posts:
    2
    Hi I have some problem in mobile target platforms (Android, iOS)

    In android, work perfectly (Release and Development)!

    In iOS, When i build my project and test with my iPhone6, 7, X, working perfect (Test: means just connect my Mac using usb and play button on Xcode)
    But. When I using TestFlight in iTunes Connect, That gives me some problem on text. Circle number is now showing . It just showing square question box.
    But it's perfectly showing circle number such as (⓪ ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ....) in Xcode running mod, I don't know how to figure it out.
    It's not working in TestFlight.

    Please Help
     
  5. BjoernW

    BjoernW

    Joined:
    Jan 27, 2017
    Posts:
    3
    I just bought the TeXDraw Package and tried it out. Looks fine so far.

    I would like to change some content on the fly. I read that this can be done via TexLink or TexInput in the manual. However I am a little lost, on how exactly this works.

    How would I go about if I want to change "\sum _1^5 7" to '\sum _1^5 8" if the player presses some input-key?

    SOLVED:
    It is as simple as
    TEXDraw myTexDraw;
    myTexDraw.text = "...."
     
    Last edited: Feb 14, 2020
  6. latrodektus

    latrodektus

    Joined:
    Nov 1, 2016
    Posts:
    9
    Hello!

    I've just purchased your TEXDraw asset and while I love what it can do, I've run into some incompatibilities with Unity's new "Universal Render Pipeline"

    The asset displays everything correctly if the TEXDraw object is on an overlay canvas. But when the object is on a World Space canvas the numbers are there but the symbols don't appear. As you can see in our image below, both objects are the same, except for which canvas they are attached to.

    Screen Shot 2020-02-11 at 3.17.19 pm.png


    I'd also like to use the TEXDraw 3D object, but when adding those to the scene, it isn't visible at all, here's the empty selection outline.


    Screen Shot 2020-02-11 at 3.29.36 pm.png


    Any help would be greatly appreciated.

    Removing the Universal Render Pipeline makes them display normally, but unfortunately we need it for many of the assets in our game.

    We are using unity 2019.3.0f3.

    Thank you!
     
  7. BjoernW

    BjoernW

    Joined:
    Jan 27, 2017
    Posts:
    3
    I can only comment on the second question.

    You have to chose a compatible material for the TEXDraw3d in the TEXDraw3d Skript Component. I am using "TEX-BumpLit" which comes with the package.
     
  8. latrodektus

    latrodektus

    Joined:
    Nov 1, 2016
    Posts:
    9
    Thanks for your response BjoernW,
    I've found that depending on which of the included TexDraw materials I use, It's completely invisible like above, or renders completely pink, meaning the material is broken.

    @WillNode Do you have any advice?
     
  9. BjoernW

    BjoernW

    Joined:
    Jan 27, 2017
    Posts:
    3
    Hmm, did you try the one I recommended? Below is a screnshot from my scene.
    Maybe it's a compatibility problem. I am using Unity 2019.1.1f1
     

    Attached Files:

  10. latrodektus

    latrodektus

    Joined:
    Nov 1, 2016
    Posts:
    9
    Thank you for checking, yes it looks like a compatibility problem. With the material you suggested applied, and the Scriptable Render Pipeline set to none, it renders properly. But if I use a Scriptable Render Pipeline asset under ProjectSettings/Graphics, It renders fully pink. This happens even if I use a freshly created Render Pipeline asset without any custom settings. Unfortunately we do need to use a Render Pipeline asset so that we can make use of Unity's Sprite Shape and 2D lighting functionality.

    Screen Shot 2020-02-19 at 1.55.00 pm.png Screen Shot 2020-02-19 at 1.55.18 pm.png
     
  11. Alzabled

    Alzabled

    Joined:
    Jul 5, 2016
    Posts:
    2
    Hi there,

    Just purchased the asset - looks great so far, but there are still some issues with the TMPro integration. Here's the error which pops up in my console (Using Unity 2019.3.3f with TMPro 2.0.1):

    Assets/TEXDraw/Core/TexFontSigned.cs(50,28): error CS1061: 'TMP_FontAsset' does not contain a definition for 'characterDictionary' and no accessible extension method 'characterDictionary' accepting a first argument of type 'TMP_FontAsset' could be found (are you missing a using directive or an assembly reference?)

    Downgrading TMPro to v1.3 is not an option for me unfortunately, although from what I can tell online is a quick-fix for this issue.

    Would be great if this could be looked into. Thanks!
     
  12. AndrewMarcHarris

    AndrewMarcHarris

    Joined:
    Jun 13, 2015
    Posts:
    2
    @WillNode Any plans to update the asset so that it works well with SRP?
     
    L_A_R likes this.
  13. L_A_R

    L_A_R

    Joined:
    May 14, 2017
    Posts:
    34
    Hi fractions aren't showing the line between nominators and denominators for me, using URP also same as others. Have since run into further problems where roots won't show now either.
     

    Attached Files:

    Last edited: Apr 5, 2020
  14. latrodektus

    latrodektus

    Joined:
    Nov 1, 2016
    Posts:
    9
    We found the only way we could get the asset to render correctly while using URP was to have your TexDraw object on a Screen Space canvas. We then have it track the position of a world object in script so it behaves as if it was on a World Space canvas. A bit of a hacky work around, but I hope it helps.
    Would love to see the asset updated to work well with URP.
     
    L_A_R likes this.
  15. L_A_R

    L_A_R

    Joined:
    May 14, 2017
    Posts:
    34
    Thank you very much for this! If it doesn't get updated I'll have to give this a crack too!
     
  16. Nefahl

    Nefahl

    Joined:
    Feb 20, 2017
    Posts:
    29
    Hello, I just imported the TEXDraw Plugin in a new project with TMP Package active, then used the "Enable TextMeshPro Integration" menu option. But now I get the following Error in the console, seems like TMP implementation has changed, can you have a look into that?

    Assets\TEXDraw\Core\TexFontSigned.cs(56,37): error CS1061: 'TMP_FontAsset' does not contain a definition for 'characterDictionary' and no accessible extension method 'characterDictionary' accepting a first argument of type 'TMP_FontAsset' could be found (are you missing a using directive or an assembly reference?)

    Assets\TEXDraw\Core\TexFontSigned.cs(50,28): error CS1061: 'TMP_FontAsset' does not contain a definition for 'characterDictionary' and no accessible extension method 'characterDictionary' accepting a first argument of type 'TMP_FontAsset' could be found (are you missing a using directive or an assembly reference?)
    Edit:
    Might be useful:
    TMP package version 2.0.1
    Unity Version 2019.3.10f1

    Edit2:
    After further digging around it seems that is has been removed on version 1.4.0, which is a bit concerning as that happend in April 2019 and has been gone unnoticed for over a year :/
    Also we can't just Downgrade TMP to 1.3.0, as that would be incompatible with the newer Unity Versions.
     
    Last edited: May 5, 2020
  17. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    Hi guys.

    I just aware that so much stuff is changing between the last year and Unity 2019.3. There's just a lot of stuff is already breaks. So to put this on concern, I have pivoting back to this asset and finishing the TEXDraw v5 development. Unfornatunely I can't promise anything yet, so please be patient.

    If you ask me, the best solution for all is to not upgrading/starting the project in 2019.3. Please use the Last (2018) LTS version. I'm aiming to finish the development before 2019 LTS get released.
     
    latrodektus and L_A_R like this.
  18. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    Just wanted to bring some news, that the new documentation is live at https://willnode.gitlab.io/texdraw/ (publicly accessible for everyone). At the time of this writing 50% features of the latest TEXDraw v4.x has been migrated to the new v5.0. You can try it at the GitLab repo.

    Also to give you some idea about its progress:

    TEXDrawAlphaProgress5-19.png
     
    latrodektus and L_A_R like this.
  19. L_A_R

    L_A_R

    Joined:
    May 14, 2017
    Posts:
    34
    @WillNode Brilliant news - TexDraw is vital to me and I have to use URP. So can't wait for it to be functioning on it! Thank you
     
    Last edited: May 20, 2020
    WillNode likes this.
  20. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    Good news everyone. SRP support is just landed on v5.x! I just aware that in SRP, you can't do multipass rendering in a single shader, which is a bummer for TEXDraw (as it's rely heavily on that). The next version comes with an entirely different render techniques where we do rendering on separate objects (and the best part here, it's hidden and automatic, you won't aware about it). Since the rendering is done that way, TEXDraw no longer need custom shaders anymore and we get 100% device coverage as much as Unity can support. A win-win solution! :D

    At the time of this writing, 70% features of the latest TEXDraw 4.x has been migrated. Although it's not completed, this is the safe point where you can grab the v5.x right now for a new, fresh project. For the rest of features and optimizations that yet to be implemented you can expect it will all comes somewhere in late June. Recently added features includes automatic height delimiters, custom font size, hbox/vbox, underline/overline and negated expressions.

    As always, you can get the next in-development version from the GitLab repo. Happy coding!
     
    L_A_R likes this.
  21. acr1378

    acr1378

    Joined:
    Dec 4, 2014
    Posts:
    76
    I am getting the same error. Has this been fixed?
     
  22. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    As of latest commit in the repo, I don't notice any problem enabling TMP integration. So it should works by now.
     
  23. acr1378

    acr1378

    Joined:
    Dec 4, 2014
    Posts:
    76
    Ok great! Where do I get that version? Is it deployed in the asset store?
     
  24. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    So far it haven't deployed in asset store so yo can try the latest one in GitLab repo (ask permission first here).
     
  25. unity_2MahcTh5TKqdhw

    unity_2MahcTh5TKqdhw

    Joined:
    Jun 21, 2020
    Posts:
    1
    Is there a way to insert charts/images with TEXDraw similarly to the way it is done in LaTeX?
     
  26. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    Current only supports this way. I might add that as a later feature, though.
     
  27. ardnaxelarak

    ardnaxelarak

    Joined:
    Sep 4, 2019
    Posts:
    4
    Is there a way to do an \underbrace (and\or \underbracket)? It doesn't seem to recognize either command.
     
  28. ardnaxelarak

    ardnaxelarak

    Joined:
    Sep 4, 2019
    Posts:
    4
    also, is there any way to apply font color to sprites?
     
  29. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    Those commands isn't available, yet. You can use horizontal extension as a workaround, e.g. {{a+b}__{\rightarrow} }__{\size[.8]x}

    You need to enable "alpha-only" in the sprite config of TexPreference. There's also true support for color-tinted sprites in current git development branch, for next v5.0.
     
  30. ardnaxelarak

    ardnaxelarak

    Joined:
    Sep 4, 2019
    Posts:
    4
    Thanks for the quick replies!

    I seem to already have "alpha-only" checked in my sprite config and it doesn't seem to care if I change the font color (either on the TEXDraw object itself or via the \color command). Do you have any idea what might be wrong?
    Knowing it's coming is good too though!

    Either way I only have a limited number of colors I need, so I can make do with separate sprites for each color for now.

    Is there a way to scale sprite size with text size?
    eg, I want something like {{a+b}__{\rightarrow}}__{2\gift}. As it is now the gift sprite is much larger than the 2, when I'd rather have them both smaller than the main text.

    From what I've seen so far it looks like I might be able to do it with a separate sprite set with a smaller "Line Height" set (so have, for example, a \smallgift that would print a smaller gift sprite), but whenever I try to add a new sprite set I always get a NullReferenceException at TexSprite.cs:45.
    I've added my sprite to the Fonts/Sprites folder and set the sprite to be multiple sprite mode (with the correct slices), but when I click "Rebuild Font Data" I get the aforementioned error. Are there any other steps I need to take?

    Thanks!

    (here's the full error message: )
    NullReferenceException: Object reference not set to an instance of an object
    TexDrawLib.TexSprite.ImportDictionary () (at Assets/TEXDraw/Core/TexSprite.cs:45)
    TexDrawLib.TexAsset.ImportCharacters (System.String newcatalog) (at Assets/TEXDraw/Core/TexAsset.cs:101)
    TexDrawLib.TexImporterUtility.CreateAndRecover[T] (System.String metaPath) (at Assets/TEXDraw/Core/TEXImporterUtility.cs:110)
    TexDrawLib.TexImporterUtility.LoadPrimaryDefinitionSubset[T] (TexDrawLib.TEXPreference pref, System.Collections.Generic.List`1[T] fontList, System.String folderPath, System.String typeStr, TexDrawLib.TexAssetType typeEnum, System.Int32 mode) (at Assets/TEXDraw/Core/TEXImporterUtility.cs:79)
    TexDrawLib.TexImporterUtility.ReadFromResources (TexDrawLib.TEXPreference pref) (at Assets/TEXDraw/Core/TEXImporterUtility.cs:23)
    TexDrawLib.TEXPreference.FirstInitialize (System.String mainPath) (at Assets/TEXDraw/Core/TEXPreferenceUtility.cs:136)
    UnityEngine.Debug:LogException(Exception)
    TexDrawLib.TEXPreference:FirstInitialize(String) (at Assets/TEXDraw/Core/TEXPreferenceUtility.cs:151)
    TexDrawLib.TEXPreference:Reload() (at Assets/TEXDraw/Core/TEXPreferenceUtility.cs:82)
    TEXEditorMenus:ImportPreference() (at Assets/TEXDraw/Core/Editor/TEXEditorMenus.cs:22)
     
  31. g0dzZz1lla

    g0dzZz1lla

    Joined:
    Jun 5, 2019
    Posts:
    2
    Hey. I have a problem with tables (\ table).
    If I am not mistaken they do not support auto wrap. Is there any way to make wide tables look normal in vertical resolution?
    ___.png
     
  32. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    From the problem that you have encounter I might suggest you to try latest in-development version from GitLab repo (ask permission first here). Doesn't mean that I don't want to fix your problems, but I prefer to keep development focus so I can release it sooner.

    upload_2020-6-27_16-1-1.png

    Be caution that the next v5.0 is radically different than v4.x so keep a backup of your project.

    Tables don't support auto wrap, unfornatunely. I suggest to split it into different components.
     
  33. ardnaxelarak

    ardnaxelarak

    Joined:
    Sep 4, 2019
    Posts:
    4
    Thanks for the suggestion! I replaced the Assets/TEXDraw with the one from the repo, per the instructions in the README, but Unity seemed to hang when loading the new assets. From looking at the logs, it looks like it got caught in an infinite loop and logged that the TEXDrawPreference import failed per the log at TEXPreferenceUtility.cs:27.
    I tried again in a brand-new project to see if I might have muddied something up with deleting and recreating the directory, but I ran into the same hang there as well. Is this anything you've seen before?
     
  34. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    Is the error recurring? What's the next error log says in the console? I don't see any problem about that yet currently. You probably want to import them in a blank project first.
     
  35. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    Today I have a good news and a bad news.

    The good news is that for the first time in three years, TEXDraw goes on sale at 50% off. The sale goes until the end of the week (July 12). Chance like this doesn't just happen in a year so if you haven't bought it, this is the best time to purchase ;)

    The bad news is, the release for TEXDraw v5 is a bit late from schedule :oops: It has better compability with Unity 2019 (and SRP) and lots and lots of features (that 2 years of development) many of you will love. Let's hope that I can make it before the sale ends in the next week.
     
  36. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    TEXDraw v5.0 has landed on Asset Store!
     
  37. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    Just a nice reminder this is the last day TEXDraw on sale :)
     
  38. cranecam

    cranecam

    Joined:
    Nov 25, 2013
    Posts:
    24
    a lot of errors importing it into 2019.4.3f1 today

    scene TEXDraw-07-TEXInput not working
    NullReferenceException: Object reference not set to an instance of an object
    TEXInput.PropagateText () (at Assets/Plugins/TEXDraw/Script/TEXInput.cs:189)
    TEXInput.OnValidate () (at Assets/Plugins/TEXDraw/Script/TEXInput.cs:202)

    TMPro not working
    PlayerSettings Validation: Requested build target group (0) doesn't exist; #define symbols for scripting won't be added.
    UnityEditor.PlayerSettings:SetScriptingDefineSymbolsForGroup(BuildTargetGroup, String)
    TEXEditorMenus:SetDefined(String, Boolean, BuildTargetGroup) (at Assets/Plugins/TEXDraw/Editor/TEXEditorMenus.cs:569)
    TEXEditorMenus:SetDefined(String, Boolean, Boolean) (at Assets/Plugins/TEXDraw/Editor/TEXEditorMenus.cs:539)
    TEXEditorMenus:SetTextMeshProIntegration() (at Assets/Plugins/TEXDraw/Editor/TEXEditorMenus.cs:369)


    Where is the manual pages on how to use it with TMPro?

    Have you tested all the example scenes in a fresh unity install?

    Or is this just happening here...
     
    Last edited: Jul 12, 2020
  39. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    Hi, just take a small break after release. Looks like that's something I'm not aware of. I'll investigate it shortly. Thanks for the report.
     
  40. JuanForero

    JuanForero

    Joined:
    Jul 9, 2019
    Posts:
    1
    When a TEXDraw object is placed in the lightweight render pipeline, none of these fonts are graphed in the viewport. (TEXDraw / Fonts / Math) do not work, how can it be solved?
    Thanks for your help
     
  41. L_A_R

    L_A_R

    Joined:
    May 14, 2017
    Posts:
    34
    @WillNode I have been waiting months for the TexDraw update, happily downloaded it and it still doesn't work on LWRP.

    "MissingReferenceException: The object of type 'TEXDraw' has been destroyed but you are still trying to access it."
    and
    "MissingComponentException: There is no 'CanvasRenderer' attached to the "TEXDraw Renderer" game object, but a script is trying to access it."
    errors are all I get.

    Please fix it, I have done all the other work I can waiting for this to be fixed.
     
  42. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    I have updated the package in Asset Store. It fixes the related rendering error.
     
    L_A_R likes this.
  43. L_A_R

    L_A_R

    Joined:
    May 14, 2017
    Posts:
    34
  44. mleonard36

    mleonard36

    Joined:
    Jul 31, 2020
    Posts:
    4
    I am getting this error on build time for WebGL, any guidance?

    Assets\Plugins\TEXDraw\Core\TexImporterSDF.cs(2,13): error CS0234: The type or namespace name 'EditorUtilities' does not exist in the namespace 'TMPro' (are you missing an assembly reference?)
     
    DTsoukalos likes this.
  45. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    Hi, that's something I aware but haven't made the fix yet. For workaround, you can double click the script and then add #if UNITY_EDITOR....#endif around the code.
     
    DTsoukalos and mleonard36 like this.
  46. tonybf

    tonybf

    Joined:
    Dec 24, 2017
    Posts:
    9
    Hello @WillNode and thanks soooo much for this asset. I really needed! I have a question, this on the image is normal?
    upload_2020-8-12_22-47-42.png
    PD: this is in the last update
     
  47. tonybf

    tonybf

    Joined:
    Dec 24, 2017
    Posts:
    9
    Another error on syntax is:
    upload_2020-8-12_23-4-12.png
    $-\frac{1}{(5 + w^2)^\frac{1}{2}} + C$
    that should render:
    upload_2020-8-12_23-6-33.png
     
  48. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    362
    These symbols: < and > only works in Math mode (between $). If you want to keep it working in Text mode, use another font, like Open Sans.

    Probably because of latest change in parser, you need to put the superscript enclosed, like:

    $-\frac{1}{(5 + w^2)^{\frac{1}{2}}} + C$
     
  49. L_A_R

    L_A_R

    Joined:
    May 14, 2017
    Posts:
    34
    Hi @WillNode
    SpacingExample.png
    1)Spacing: How do I make this text spacing even?
    2)Font-size: How do I make it auto-scale it's font size to fit the box?

    I am using the latest version.
    I have looked through the docs and can't find how. Sorry if I have missed it.
     
    Last edited: Aug 13, 2020
  50. tonybf

    tonybf

    Joined:
    Dec 24, 2017
    Posts:
    9
    Thanks for your answer, try enclosing it and it seems to work, but:
    upload_2020-8-13_13-9-18.png
    It doesn't look very good or like it should.The problem is that the fraction line is not centrally aligned with the operators. Thank you very much for your prompt customer service.
     
unityunity