Skip to main content
Version: 5.x

Collect Coins

An example of how to use physics in a game and see how the collision process takes place and create random elements that use physics.

The Collect Coins Physics Template was created and provided by Maha Aldosary

Template Walkthrough

Game Controller

With Game Controller, you can set up the intro scene, game scene and gameover scene.

With Game State Config, you can modify the settings for each scene. Such as enable objects or clear children of objects, modify the sound settings.

Spawn Random Elements

With Spawner Script, you can select the elements that you want to be randomly generated in the game.

Choose the Spawner object in the Scene Hierarchy panel, you can modify objects dropped in the scene randomly and adjust frequency.

Behavior Script with Physics

With Behavior Scripts, you can trigger Add Score or Dead effects. You can find all the behavior scripts under Add Score object and Dead object.

With the Behavior script, you can use Physics Collider Event as the trigger and filter the Scene Object’s name. Based on the name, you can trigger Add Score or Dead effects.

To learn more about Behavior, check out the Behavior Guide!

Physics Objects Prefab

You can find Bomb and Coin Prefab in the Asset Browser panel. Drag the prefabs to the Scene Hierarchy panel to check out the setup.

Previewing Your Lens

You’re now ready to preview your Lens! To preview your Lens in Snapchat, follow the Pairing to Snapchat guide.

Was this page helpful?
Yes
No

AI-Powered Search