Make a Whack a Mole Game in Unity (Free Tutorial)
Tags: tutorial, gamedev, unity3d, programming
Published: 2022-08-13 00:36:01

Whether you’re whacking moles in real life or need to change out assets for projects deployed on multiple platforms, [echo3D](http://www.echo3d.co\) makes it easy to do this by simply using an API key 
and updating in 1 place. Assets are stored on the [echo3D](http://www.echo3d.co\) cloud and called at runtime so you can focus on other things. Like looking for mole hills.

![](https://miro.medium.com/max/1200/1*uXwS6BxKcz8CUQFcy2PxRg.gif)

***

<center> Click this link [**https://go.echo3d.co/Dvxj**](https://go.echo3d.co/Dvxj) or scan this QR code to see the celebrity mole in AR.

![](https://miro.medium.com/max/1190/1*2VPkkhyDGSAPPIEbBH-csw.png) </center>

***

Register
========

Don’t have an echo3D account? Register for FREE at [echo3D](https://console.echo3d.co/#/auth/register).

Version
=======

[Unity 2020.3.25f1](https://unity3d.com/get-unity/download/archive)

Setup
=====

*   Clone this [repo](https://github.com/echo3Dco/Unity-echo3D-Demo-WhackAMole), see the full README
*   [Import the Unity SDK](https://docs.echo3D.co/unity/installation)
*   [Add the assets](https://docs.echo3D.co/quickstart/add-a-3d-model) to the echo3D console from the Unity ‘Models’ folder
*   Uncheck the [Security](https://docs.echo3d.co/web-console/deliver-pages/security-page) box in your console
*   In Unity, open the _SampleScene_ scene
*   Drag the _echo3D_ script to the Mole prefab in the Prefab folder
*   Add the API key and entry ID for each object in the Inspector

![](https://miro.medium.com/max/1400/1*0Z_JDVXFCJNPaE9CkL18BA.png)![](https://miro.medium.com/max/1040/1*-T_RzpcgJp9aAFEyxPYf-Q.png)

*   In the Hierarchy, make sure to the boxes are unchecked for the Sprite Renderer for Background
*   Adjust the [metadata](https://docs.echo3d.co/unity/transforming-content) in the echo3D console so it matches the spawn points in the Hierarchy

Run
===

*   Press _Play_ in Unity. Click on the moles to whack them. You have 20 seconds.

Switch Out Assets
=================

*   Find new asset in the echo3D console (You can upload your own or choose from our library)

![](https://miro.medium.com/max/1200/1*Ej527j0FyKH-Niin_tC4Ig.gif)

*   Get the API key and entries ID

![](https://miro.medium.com/max/1400/1*0Z_JDVXFCJNPaE9CkL18BA.png)

*   Swap them out on the echo3D script in the Unity Hierarchy and see your assets change when you run in Play mode

![](https://miro.medium.com/max/664/1*LIJnwnUcRyRt4Eskmb6QyQ.png)

Learn More
==========

Refer to our [documentation](https://docs.echo3D.co/unity/) to learn more about how to use Unity and echo3D.

Support
=======

Feel free to reach out at [support@echo3D.co](mailto:support@echo3D.co)or join our [support channel on Slack](https://go.echo3D.co/join).

Sources
=======

*   Mole asset: [freepik](https://www.freepik.com/free-vector/lovely-happy-groundhog-day-background_832681.htm#query=mole&position=22&from_view=search)
*   Hammer and title: Canva

Support
=======

Feel free to reach out at [support@echo3D.co](mailto:support@echo3D.co) or join our [support channel on Slack](https://go.echo3d.co/join). For additional troubleshooting, debug [here](https://docs.echo3d.co/unity/troubleshooting).

More Tutorials
==============

For more easy tutorials, check these out:

*   [Build a 3D Balloon Pop game in Unity](https://medium.com/echo3d/build-a-balloon-pop-game-unity-free-eed9fe7d8be9)
*   [Get a Quarantine Dog in AR](https://medium.com/echo3d/get-a-quarantine-dog-in-ar-8383ea55376b)
*   [How to Create 3D Content and See It In AR](https://medium.com/echo3d/how-to-create-3d-content-and-see-it-in-ar-free-no-coding-required-369e5b4a4b3e)

****

>_**echo3D** ([www.echo3D.co](http://www.echo3d.co/); Techstars 19’) is a cloud platform for 3D/AR/VR that provides tools and network infrastructure to help developers & companies quickly build and deploy 3D apps, games, and content._

![](https://miro.medium.com/max/1400/1*cNrRDT0JEpkcy-zG6KBNgw.png)