Search Unity

Am I dumb or is it difficult to keep best practices while using Unity?

Discussion in 'General Discussion' started by evan_ohara, Jul 20, 2019.

  1. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    4,012
    The main point why I brought up TextMeshPro.SetText is because it does not cause an allocation. If you want to display a simple formatted text only, like the score example, and you don't have a reason to keep it as a string, I found using TMPro beneficial from a GC alloc point of view.

    string. Format or any other string concatenation features like StringBuilder.Format, string.Concat, etc all create new strings and thus alloc memory / garbage. Haven't checked the latest C# / .NET Framework though, but I doubt it changed.
     
    frosted likes this.
  2. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    4,270
    Well. Though.
    892012_10201781646437132_2059252129_o.jpg

    I took this photo in the Computer History Museum in Mountain View, CA. All the computer languages are built on each other. Not too surprisingly.

    (Mobile photo was taken in 2013 I think, without flash and in somewhat dark, so it's not the greatest quality, sorry about that)
     
    angrypenguin likes this.
  3. Owen-Reynolds

    Owen-Reynolds

    Joined:
    Feb 15, 2012
    Posts:
    730
    Big fold-out posters like that used to be common. It's fun when they're in a CS Dept hallway, since everyone has an opinion how it should have looked. But someone who can program, even a little, is beyond it. They can see specific things languages borrow from each other, and why. Often some other language does a feature really well, and has the best explanation. StackOverflow also has plenty of nice "how do I do Y in language Q?" questions -- like how to make Java-style enums in C#.