We Are All Accustomed To +=

Whenever you wish to concatenate two strings in your project, at some point you probably ended up doing something like: string myString += "myOtherString";

The reason? It is of the first things you are probably taught to be able to do while programming, and it’s super easy to keep using, especially if you need to make a really long string.

The only issue on the long run, is that if all the text in a project is generated this way, it might have an impact on game performance, WITHOUT BEING “DRAWN” in the scene. So you might want to take a look at it.

There Must Be A Better Way

Instead of the normal operation, you should do something like the following:

    StringBuilder _sb;
    
    private void Awake()
    {_sb = new StringBuilder()}
    
    private void CleanStringBuilder()
    {
        _sb.Length = 0;
        _sb.Capacity = 0;
    )
    
    public string Concatenate(string stringOne, string stringTwo)
    { 
    	CleanStringBuilder();
    	_sb.Append(stringOne);
    	_sb.Append(stringTwo);
    	return _sb.ToString();
    }
See The Wiki Entry

Of course, this seems like a lot of work for a few rescued bytes here and there.

Which is why I suggest using the StringBuilderExtension class over at the Unity Tools Repository, to be able to do the following:

string myString = "Hello".Append(" beautiful", " sparkly", " world"); // Results in: "Hello beautiful sparkly world".
So you don’t need to make **ANY** prep work involving StringBuilder for each class.

Get More Useful Tips On The GitHub Wiki

What you just read about was ONE of several unity tips that are available on the Unity Tips Wiki.

Please also note that the wiki is updated often, so make sure to check it out!

Read More Unity Tips!

Interesting how we all grow used to the “dirty” implementations huh? Well, it is better to know that later over never.

This concludes today’s post.

But Like Always…

Thank you very much for reading my blog :3

Winter Is Here

(Spent So Much Trying To Make Pun With That Reference, And The Post Contents, But Failed)

	<img   src="/images/posts/2018/01/Winter-Sales-2017-End.png" alt="" />

It is official, wallets are now safe (or at least safer), until the next big Steam sales.

And yes, this might be too well put together to be a coincidence, so I’ll admit it now. This was all part of my evil master plan, to make you spend a couple cents:

	<img   src="/images/posts/2018/01/PEG-Level.gif" alt="" data-recalc-dims="1" />

Head Over To The Sale

PEG 99¢ 84¢ Steam | itch.io

From now until the 22nd PEG is going to be on sale. And all I have to say is that if you don’t get it now, the next sales will probably be in around three months.

However, as a little pro-tip to you, blog reader, if you wait until next Monday, you can ALSO GET KNIGHTS ON A DISCOUNT!

What is more, the bundle that contains KNIGHTS and PEG, ALSO STACKS WITH INDIVIDUAL DISCOUNTS.

If you do get the game, hope you like it as I know many have. So thank you for your time.

And Also…

Thank you very much for reading my blog 🙂

Swiftly Organize Your Code With A Simple Command

GameObjects in Unity’s hierarchy are both a charm and a curse. The distinction, relies heavily on how well you organize and break down the functionality of your game.
You can esentially use GameObjects as folders, in fact, I haven’t seen a project that doesn’t do this.

However, a minor complaint of mine was that in order to use them as a folder, I had to do the following EVERY TIME:

  1. Create an empty GameObject.
  2. Reset that new GameObject’s transform.
  3. Reset the items to be contained within the new “folder”‘s transform as well.
  4. Drag and drop them into the “folder”.

Sure, they aren’t THAT many steps or too complicated for that matter, but when you do this over and over, you are just bound to mess up on those transforms.
This is why this utility was created, just to save headaches down the line.

Download The Tool

Just leave the script inside a folder named  “Editor” and then you can use:

CTRL+G

While selecting two or more items in the hierarchy to make use of the tool.

Simple and effective 😀

Download it for FREE!

Visit The GitHub Repository For More FREE Tools

You just read about one of several FREE tools that you can get on the Unity Development Tools Repository. Again, they are FREE so just go see them, there are neat things in there~

See all of the tools!

The post is short again, but with a tool so straightforward and useful, you shouldn’t need more information.
So I hope it becomes useful to you and your games :3

Just Remember, Like Always…

Thank you very much for reading my blog :3