8 great Unity resources to aid you with 2D development

Creating a 2D project in Unity is very similar to creating a 3D project.  Therefore getting a your head around the basics of the engine is just as important when embarking on a 2D project within the engine.

Here’s a list of sites offering free and paid courses to help you gain the fundamentals needed to begin your project.

  1. Unity Magic
  2. Udemy
  3. Unity Cookie
  4. UnityCoder
  5. Unity3dStudent
  6. LearnUnity3D
  7. Code Project
  8. Unity Tutorials by Infinite Ammo

Top 6 resources to learn Unity 2D

What is Unity 2D?

Unity 2D is the official native 2D toolset released with version 4.3 of Unity.  This version was released in late August 2013.  As many developers utilised the engine for 2D development as much as for 3D it was a welcome addition to the vast array of tools that are available in the engine already.

Here’s the top 6 sites and books that I have found that will help you get started with 2D development using Unity’s 2D tools.

  1. Official Unity Live Training
  2. Official Unity 2D Tutorials
  3. Learn Unity 2D
  4. Unity 2D Game Development by Example Beginner’s Guide
  5. Unity 2D Game Development
  6. Mastering Unity 2D Game Development

What is a Full Stack Developer?

I like to read job specifications for the roles that I’m working within.  By doing this I can see what skills are being required in the ever changing field that I’m working in.  As I read more and more job descriptions of software developers I’ve found the term “Full Stack Developer” coming up time and again.

So what is a Full Stack developer?  I have come to the conclusion that a full stack developer is a software developer with a familiar knowledge of a wide range of tools and technologies and is capable of using and implementing all that they know whether this be back-end or front end development.

Knowing a bit of everything means that you can pick up work from others quite quickly without having to spend time learning the basics.  And although they don’t have a deep understanding of any tool they are capable of implementing a solution from concept to production and are able to anticipate problems that may arise.

For more information read this post on Codeup.

Web DAV and Http Attributes

What is WebDAV?

The element contains the settings that configure Web Distributed Authoring and Versioning (WebDAV) for Internet Information Services (IIS) 7.

WebDAV is an Internet-based open standard that enables editing Web sites over HTTP and HTTPS connections. WebDAV yields several advantages over the File Transfer Protocol (FTP), the most notable advantages are more security options and the ability to use a single TCP port for all communication.

Why does it interfere with http attributes?

The http attribute requests mean that only methods using those specific attributes will affect certain methods e.g. a method with a [HttpPost] attribute can only be called using a POST call. All other methods without this attribute will be ignored.

Note: Methods without any attribute will default to using a [HttpGet] attribute.

Using more than one attribute

You can assign multiple attributes to one method if necessary. To do this you can use [AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)]

Can it affect every site set up on IIS?

Yes, if they use these attributes.

Any other issues?

After speaking to a senior developer, changing the config file of a site to accept [HttpDelete] isn’t the safest thing to do and that this affects routing too. Not all browsers may accept this change so sites may be blocked. So this is not the best solution.

References

Re-using Code

Code reuse and refactoring is a major part of a good developers skill set.  There’s very little time in the day to rewrite a perfectly good code snippet and there’s no reason why you should re-invent the wheel for every new task.  Code reuse means that you focus on learning new things with your time not rehashing old problems already solved.  As a result you work harder,  you work smarter and more efficiently.

Embrace code reuse, don’t think any less of yourself by re-using code that suits your purposes or something that just needs a few tweaks here and there.

New to NuGet? This may be for you

What is NuGet?

Quotes from the NuGet website:

NuGet is the package manager for the Microsoft development platform including .NET. The NuGet client tools provide the ability to produce and consume packages. The NuGet Gallery is the central package repository used by all package authors and consumers.

So what do I understand NuGet to be? NuGet is a Visual Studio extension used to package up Microsoft developed projects e.g. .NET projects. NuGet provides its own tools to create these packages, integrate them into your solution/projects and distribute them to others.

The central package repository is the NuGet Gallery that can be accessed by all package authors and consumers. However, if you don’t wish to share your work with the world, you can set up your own NuGet repository for use within projects on your own private servers.

When you use NuGet to install a package, it copies the library files to your solution and automatically updates your project (add references, change config files, etc.). If you remove a package, NuGet reverses whatever changes it made so that no clutter is left.

Depending on the method you use to create your package, you may choose the location that the package gets installed to. Making additions to your project using NuGet will also update your project and, when removing a package, NuGet will helpfully clear everything up too.

To learn more about NuGet go to the official website.

Why was I reading about NuGet?

A prototype used for front-end development to consume services from a back end system was created. The front-end project needed to be delivered to a number of environments and projects across teams to be integrated into websites. We were looking into possible ways to distribute this to the teams. As the developer who created this was using NuGet we continued exploring its uses.

There are a number of tools that have been developed for use with NuGet for package distribution across projects that you may use as an alternative to NuGet’s solution like OctoPack. This is up to you but I decided to stick with the functionality of one tool and get familiar with that first.

Why should you use NuGet for your project?

Firstly, you don’t need to use anything additional within your Visual Studio project (only use tools that are essential!), but consider the following points. They may help you decide whether you need to use NuGet.

Questions that may apply to your project

  • Team
    • Is your team getting very big?
    • Are some or all members of your team working in remote locations?
  • Project
    • Does your project need to be available only to those within your team and can’t be hosted on a live server?
  • Time
    • Are you concerned about the amount of time that it takes to distribute the latest version to your team members?
    • Do problems occur when trying to use your current distribution system to update your team with your new versions?

Benefits

  • Ease of use
    • NuGet has quick and easy interfaces and tools to create and get packages updated within projects
  • Able to integrate into build process
    • Using Microsoft Build Events you can ensure tie in the creation of NuGet packages into your builds to different environments
  • (Using the Package Explorer) Able to package up separate files intoNuGet packages
    • The package explorer is simple and quick to use. With one download from the NuGet site and a quick start guide to help, you’ll have created your first package in minutes.
  • Able to manipulate the location of file once added into project
    • This can be done via the Package Explorer or if you decide to integrate the creation of packages into the build process.

Drawbacks

  • Out of the box solution only allows you to integrate the creation ofcsproj andNuspec files into packages.
    • Not very useful if you’re wanting to distribute a simple JavaScript library. There are ways of getting this to do what you want but it may involve creating batch or potentially PowerShell script files to extract the correct file for the NuGet package. Worth it in the long run if that’s what you need, but you will have to weigh up the costs and benefits.

NuSpec files

The NuGet site defines a NuSpec file as the following:

A nuspec file is a manifest that uses XML to describe a package. The manifest is used to build a package and is also stored in the package after the package is built.

NuSpec files are manifest files written in XML that detail the content and dependencies of your NuGet package.

Creating a NuSpec File

There are two methods that currently exist to create a NuSpec file.

From an Assembly

If you have an assembly, you can generate a NuSpec file from the metadata using the Package Manager Console in Visual Studio.

Manually

Alternatively, you can create a NuSpec file within a text editor and adding the basic content shown below.

xml version="1.0"?>
xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>$id$</id>
<version>$version$</version>
<authors>$author$</authors>
<description>$description$</description>
</metadata>
</package>

Creating a NuSpec file manually once you have decided on the contents takes one minute. Generating the file from an assembly also is a five-minute task so if you need to create one don’t be discouraged, it’s easier than you think.

For more information see the NuGet site on NuSpec files.

Creating NuGet packages

There are two methods that currently exist to create a NuGet package.

Using Package Explorer

A handy guide to using the Package Explorer can be found on the NuGet website.

Automated Build process

To create NuGet packages via Visual Studio builds you will need a plugin. I chose to use one called CreateNewNuGetPackageFromProjectAfterEachBuild. This can be set up to build on specific build configurations and/or build definitions. Other build attributes like the version number and location to deploy the package to can be configured within PowerShell script files or post build events.

How do I get NuGet?

So have you made a decision about whether NuGet is right for you and your current project? Do you want to use it? If the answer is yes then follow these instructions to get NuGet installed.

Grabbing the latest version of your NuGet package

You will need a location on your server to set up your private NuGet Repository.

Once you have the Package Manager Console installed you can use this to install the package. Or use the Manage NuGet Package option (when you right-click on the References folder of your project) to add this to your project.

The last option is to use the menu bar:

  1. Go to Tools > Extensions and Updates.
  2. Search the Online filter for NuGet Package Manager for Visual Studio and install this
  3. Next go to Tools > Options > NuGet Package Manager > Package Sources
  4. Add your internal NuGet respository (the source should be the same as the host file entry)
  5. Click OK

So what do you need to grab the latest version?

  1. If you haven’t got it already, get the NuGet Package Manager for Visual Studio from Tools > Extensions and Updates.
  2. Search the Online filter for NuGet Package Manager for Visual Studio and install this
  3. Next go to Tools > Options > NuGet Package Manager > Package Sources
  4. Add your internal NuGet respository (the source should be the same as the host file entry)
  5. Click OK
  6. In the Solution Explorer, right-click the References folder in the project
  7. Click on Manage NuGet Packages

You should then be able to see your NuGet package listed under Online when you have selected the Nuget repository

References

Contact me

If you have any feedback for this guide, spotted mistakes, broken links, outdated content etc please feel free to contact me via email. If you found this guide useful please also let me know.

32 Days Left!

In 32 days (approximately) I’ll be a mum. Strangely I’m not very anxious about it at all. The only thing that concerns me is the first couple of weeks where I’ll have next to no sleep because of the 2 hourly feeds (i’m not great without sleep) so this should be a challenge, but I’m looking forward to it. It’ll be nice to put a face to the little person I’ve been talking to the past 5 months.

Over the next 30 days I have a jam packed schedule. My husband and I need to finish decorating our house (yes I’m still doing DIY), I’ve a load of books and PDFs to read related to my job and interesting topics, I need to dust off my MacBook to develop something in Unity and squeeze in some 360 gaming.  Not a lot at all!

Wish me luck!

9 steps to approach a development task

We work using the agile methodology SCRUM. For those that aren’t familiar with the process, here’s a brief explanation.

SCRUM is a process of working to create a product that is iteratively developed by breaking down all new requests for big features know as Epics into bite sized chunks called Work Items. Each project usually has a team of 5 – 9 people (the optimum being seven) working on a set of items for an agreed length of time, known as a Sprint.

Our team sprints usually last two weeks so every two weeks we have a new set of items divided up between the team.

As a new developer I’m trying to focus on producing the best work in the minimum amount of time. This is obviously going to take me longer than someone who has a number of years development experience but getting into the right process now may save me so much time in the future.

In our team we are using Test Driven Development (TDD) so instead of jumping into development, you write out unit (or integration tests) to check that your work passes. This produces a quick way to check after you have finished development if any issues have arisen within your code even after years of functionality being added. New functionality means new tests to be written so eventually you build up a solid set of tests to fully cover the code you have written.  This is known as code coverage.  The tests that you write are located in a separate test project alongside your project within your solution.

Early on into my transition, I asked my manager (who’s been developing for about 10 years across different technologies and software) the best way to approach a task.  Here’s his advice in 9 simple steps.

1. What’s your goal?

You must clearly understand your work item, what the business requires from this change and what the business value of this change is. If you’re not sure about any of these things talk to people to gain this knowledge before attempting any coding.

2. Discuss the best way to accomplish your goal with others

Consult with other more experienced minds in your team to help you get to your solution quickly.  The aim here again is to use your time efficiently.  By all means try and overcome challenges yourself but be mindful of the time you spend on it.  You should not and do not need to shoulder all the work yourself.  No matter what level of experience you have, don’t be afraid to ask for help.

3. Breakdown your goal into tasks and objectives

Smaller chunks are easier to digest.  It’s just logical.  So before you begin, think about your goal and what you need to do then tackle each task one step at a time.

4. Look for similar, existing unit tests and run them

Think about the current functionality that exists in the product your enhancing.  Is there anything similar that you can step through and debug to help you make your task easier?  If you find any methods like this try and find tests that execute these methods to check if you can extend them to fulfil your new task.

5. Write your new test

If all else fails, write a brand new test from scratch.  But start by writing a test and not by writing the code for your solution.

6. Solve the task with the minimum amount of code

Try and use the least amount of code to write a solution for your task in order to fulfil it.  Don’t worry about efficiency yet, just get it done.

7. Make your test pass

Run the test over your small chunk of new code ensuring that it passes and fulfils it’s task.

8. Then refactor your code

Now that your test has passed you can extend your solution to become more efficient.  Don’t forget that for every new method you may need a new test.

9. Work back through step 7 – 9

Repeat steps 7 through 9 to ensure that the changes you have made in your code don’t make the test fail.  If it does, debug the test to find out why it’s now failing.

Feel free to add in as many asserts to verify the outcome of your tests are correct and reliable at any stage.

And that’s it!  Easy right?  Well no actually, it take quite a lot of discipline especially when you’re a junior developer to avoid jumping straight into coding the solution.  But writing tests as you go along will save you time during and after the development of your tasks.

Related Links