Skip to content

Using Other Peoples Code

Aaron Freedman edited this page Jul 27, 2018 · 1 revision

How to use code or assets authored by someone else

There is nothing inherently wrong about learning from and using code you find in a book or online as long as you understand how the code works. In fact, I encourage you to do this. In most cases you will need to port this code to function in your game, anyways.

Please note that you are restricted from using external libraries, plugins, asset packages, or other codebases in your projects for this class.

When to look for help

You will most likely have the urge to find code online in the following situations:

  • You're trying to implement a feature and have no idea how to implement it
  • You're trying to implement a feature and it's not behaving as expected
  • You're trying to mimick behavior found in some other game
  • You have a bug and everything is breaking and you're about to throw your computer out of the window

Your first instinct should be to check the Unity manual and the MSDN C# reference before Googling it.

Your second instinct should be to log an issue in this repository's issue tracker detailing your problem if finding a solution takes longer than a few minutes. Chances are one of your classmates has already encountered the problem, or will encounter it eventually.

Checklist

During this class, if you find yourself copying code from somewhere else make sure to ask the following questions:

  • Do I trust the source of this information?
  • Do I understand what this code actually does?
    • Example: Am I sure I'm actually writing a save file and not deleting my operating system?
  • Do I even need to implement this feature?
  • Is there something more important to do first (that I have at least a vague idea of how to implement)?
  • Does Unity or C# already provide an implementation of this feature and I simply neglected to look in the manual?
  • Will implementing this code in my game cause me more problems later?
  • Is there a better way to implement this feature?
  • Did I check if I have permission to use this code?
    • If I have permission to use this code, did I attribute it?

Guidelines

Please adhere to the following guidelines for all game development tasks (code, asset creation, etc.). These guidelines apply to both individual and collaborative work.

  • You are expected to write your own code, within reason
  • Copying or mimicking code from course materials or official documentation is permitted
  • Using code from Unity’s standard assets is permitted unless specified otherwise
  • In cases where you have used code from an unofficial source, document such use within the file
  • You may not use 3D assets from another class in your assignments for this class
  • You may not use any assets downloaded from the internet, Unity Asset Store, or some other source without written permission
  • Make sure to check licenses for any code that you’re going to copy (just because it’s online doesn’t mean you can copy-paste it into your game)

In most cases, you will find yourself copy-pasting code from the web when you do not know how to do something. Document the source of your solution for your own sanity. The solution you found might not be correct.