Legacy Documentation: Version 2018.2 (Go to current version)
Create Game Script
Play To Validate
Other Versions

Attach Game Script

The UnityAnalyticsIntegration script can be attached to any GameObject in any Scene in your game to initialize the Unity AnalyticsA data platform that provides analytics for your Unity game. More info
See in Glossary
SDK. We recommend you attach the script to a GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
in the first SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
of your game to ensure you begin capturing as much user engagement data as possible.

In this example, we will attach the script to MainCamera. First, locate and select “Main CameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary
” in the Hierarchy tab on the left hand side of the Editor.

Drag your script from the Projects tab and drop it on the Main Camera GameObject. In the InspectorA Unity window that displays information about the currently selected GameObject, Asset or Project Settings, alowing you to inspect and edit the values. More info
See in Glossary
window, with Main Camera selected, you should see that the script was assigned to the Main Camera as a Component.

Note: You can also add a script to a GameObject by selecting the GameObject in your Hierarchy and adding the desired script Component to it in the Inspector.