Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

StartSDK Error

Discussion in 'Unity Analytics' started by aluzino1811, Feb 18, 2015.

  1. aluzino1811

    aluzino1811

    Joined:
    Feb 18, 2015
    Posts:
    1
    Im trying with Unity Analytics but when i put the code i get the next error.

    UnityAnalytics' does not contain a definition for `StartSDK'

    10984301_10206354228640921_5558131844287056505_n.jpg

    My code:


    using UnityEngine;
    using System.Collections;
    using UnityEngine.Cloud.Analytics;

    public class UnityAnalytics : MonoBehaviour {

    // Use this for initialization
    void Start () {
    const string projectId = "PROJECTID-GOES-HERE-66fb5cf028d728bb";
    UnityAnalytics.StartSDK (projectId);
    }

    }
     
  2. kentunity

    kentunity

    Unity Technologies

    Joined:
    Sep 16, 2014
    Posts:
    55
    Hi @aluzino1811

    The problem here is that your class name is UnityAnalytics, and our SDK's class name is also UnityAnalytics.
    Just rename your class to something else besides "UnityAnalytics" and it should work.
     
  3. mbirk

    mbirk

    Unity Technologies

    Joined:
    Apr 25, 2014
    Posts:
    18
    Hi @aluzino1811,

    Also, don't forget to change the "projectId" string to your actual Project ID! Otherwise you won't be able to access any of the data that we collect. You can see this Project ID in the dashboard beneath the project name:
    1. Go the the Unity Analytics dashboard at https://analytics.unity3d.com
    2. Create a new project or click on an existing project.
    3. You can see the Project ID beneath the project name at the top of the page.
    4. If you click on the "Integration" tab in the left sidebar, and then click on "Create Script", you will get a code snippet that is customized for you project, and you can simply copy-paste it into your script.