Saving Re-Writing Code Since C# 4

When building your own systems, you might sometimes require a method you just made to slightly change its functionality in some cases.

It might be that you wish you could provide an extra boolean or number to that method, without breaking all you have already done.

In these cases, what you are looking for are optional parameters, something already built-in in C#:

Simple, Yet Powerful

  1. Write down your method.
  2. When declaring the parameters it should receive, make sure the parameters you want to make optional are ALL located at the end of the list.
  3. Assign a value to each of those parameters you want to make optional. (That value will be the “default”.)
  4. When calling the method, cover all non-optional parameters, and use as many optional parameters as you want.
Read The Full Tip HERE

Get More Useful Tips On The GitHub Wiki

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

So if you liked the one you just read, be sure to check it out (or star it) as it gets updated often! 😮

Read More Programmer Tips!

I love optional parameters, especially in game development. For example, I can create an instance of an object in a scene, and via optional parameters set the default position and rotation to 0, but leaving the option to specify them. It’s magic.

So I hope knowing this becomes useful to someone else.

That Is All For Today, But Like Always…

Thank you very much for reading my blog :3


Do you make games? Then I got something for you.

Given how you are reading about Unity tools, just wanted to extend you an invitation to subscribe to the GAME DEVELOPER newsletter for FREE.

Don’t worry, you will ONLY receive notifications on game development content, which include helpful game development tutorials, tips and tricks, and updated on new FREE dev tools directly on your inbox.

You Probably Don’t Want Walls Colliding With One Another… Probably…

There are many game genre’s that rely on physics, maybe even almost all of them actually. Bullet hell, hack and slash, platformer, action, and maybe even puzzle games. So chances are, a game you are working on needs things to bump into other things.

But the thing is, you might not actually need them to collide with ALL of the other things.

To give a quick example, in bullet hell games, you might want enemy bullets to collide with the player, but not between themselves or with other fellow enemies. So, have them not interact between them at all then. Not only will this reduce the amount of calculations, but will also save you the need extra condition checks like:

public int damageToMake;
private void OnTriggerEnter2D(Collider2D other)
{ 
	if (other.tag.Equals("Player"))
	{
		ServiceLocator.GameManager.DamagePlayer(damageToMake);
	}
}

You could potentially remove the if condition if you knew right away it can **ONLY** collide with the player. This might not look like much at first, but when the amount of bullets that appear on screen are well other a thousand, this is golden optimization.

It Is Hidden In Plain Sight

If you want to edit the collision matrix yourself just head to:

Edit > Project Settings > Physics / Physics 2D

Just note that if your project uses both 2D and 3D physics at the same time (for a good reason above normal comprehension), you will have to edit both matrices, as they are independent from one another.

See The Wiki Entry

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!

I felt like doing a bullet hell game just after finding about this matrix, but I guess that is just me.
But hopefully, you learned something useful today.

But Like Always…

Thank you very much for reading my blog :3


Soooo you like Unity huh? Do you make games? If so, I have something for you.

Given how you are reading about Unity tools, just wanted to extend you an invitation to subscribe to the GAME DEVELOPER newsletter for FREE.

Don’t worry, you will ONLY receive notifications on game development content, which include helpful game development tutorials, tips and tricks, and updated on new FREE dev tools directly on your inbox.

Comment Many Lines At Once

Sometimes you are in need of modifying many fields at one, to make them ALL from private to public.
Other times you might want to _leave a comment on many lines_, while having those comments aligned.
And finally, other times, you just want to delete many lines at once.

If this has ever been the case, and you use Visual Studio, then you are in luck, as this popular IDE also counts with a way to manipulate as many lines as you want at once:

Pretty Straightforward

  1. Press the ALT button on your keyboard and leave it pressed.
  2. Select multiple lines and release.
  3. Type whatever you want on all lines at once.

Read The Full Tip HERE

Get More Useful Tips On The GitHub Wiki

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

So if you liked the one you just read, be sure to check it out (or star it) as it gets updated often! 😮

Read More Programmer Tips!

Visual Studio sure is neat huh? It is a shame we often miss out on cool obscured features like that.

But For Learning About This Feature Here…

Thank you very much for reading my blog :3


Do you make games? Then I got something for you.

Given how you are reading about Unity tools, just wanted to extend you an invitation to subscribe to the GAME DEVELOPER newsletter for FREE.

Don’t worry, you will ONLY receive notifications on game development content, which include helpful game development tutorials, tips and tricks, and updated on new FREE dev tools directly on your inbox.