Want to try this Exercise?

Check out the about tab below and start learning on CG Cookie today.

Get Started

Creating Magnetism

  • Software:Unity 5.0  ·
  • Difficulty:Beginner

Rules of the Exercise

  • 1
    You must utilize magnet and bolts assets provided and/or recreate a similar scene yourself
  • 2
    Bolts and Gear must be the only things attracted to the magnet
  • 3
    A UI based button must enable and disable the magnetism effect


In this Unity exercise you will be required to utilize the assets provided within the project source files. The goal of this exercise is to create a magnet that can be enabled and disabled with a UI based button. Only the bolts and the gear should be attracted towards the magnet and not the spheres. There are multiple ways of achieving this effect. You'll be provided with the 3D models shown in the video along with a couple of PNG files for the UI images used. Grading Criteria: Minimum of 6 passing votes by community and/or instructor(s) magnetism


  • Watch the video above for specifics on what the exercise entails.
  • Download the starting project source files which contains a pre-made Unity scene with all the objects needed in place.
  • Familiarize yourself with C# scripting by watching the C# Bootcamp course .
  • Follow the rules on what guidelines you need to follow and have fun!

How to Upload

You will need to upload a Web GL file as a submission. You'll upload your project externally then provide a public link to your index.html file. Here are a few lessons that go into more detail: https://cgcookie.com/lesson/building-for-web-gl/ https://cgcookie.com/lesson/using-web-gl-with-dropbox/ https://cgcookie.com/lesson/publishing-web-gl-with-wordpress/

Instructor Notes

Watch the video below to see how I tackled this exercise.