Search Unity

Set ProjectId via code?

Discussion in 'Unity Analytics' started by martingonzalezetermax, Dec 11, 2017.

  1. martingonzalezetermax

    martingonzalezetermax

    Joined:
    Dec 11, 2017
    Posts:
    24
    Hi there!
    I've searched if there is a way to initialize and set a project id via code but i didnt find anything.
    I need this because we have our continuous integration pipelines and i would like to know how can i set up the analytics service via script so i don't have to use the editor window.

    Thanks!
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @martingonzalezetermax Can you elaborate as to where you need your ProjectID set via code? We autogenerate the ProjectID for you, and is not something you can generate yourself.
     
  3. martingonzalezetermax

    martingonzalezetermax

    Joined:
    Dec 11, 2017
    Posts:
    24
    Once you connect to the services that is persistent in a .asset file?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Are you referring to the ProjectID? Please describe your requirements a bit more, do you already have a ProjectID, or are you trying to generate a new one.
     
  5. martingonzalezetermax

    martingonzalezetermax

    Joined:
    Dec 11, 2017
    Posts:
    24
    Sorry, i have my ProjectID already, i created the project thought the web page with my user, the in the editor i logged in, went to services and link it with that project and everything works fine.
    What i'm asking is if there is a way to avoid the Service tab flow in the editor and set the project id with a custom script or in the build pipeline. So we do not depend on going, connecting, setting up.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    So you have a new project that is not Analytics enabled, and you want to enable Analytics via scripting, is this correct? Keep in mind that once you enable a project for Analytics, you don't need to re-enable it each time you perform a build.
     
  7. martingonzalezetermax

    martingonzalezetermax

    Joined:
    Dec 11, 2017
    Posts:
    24
    Perfect, in same way it persist the analytics settings.

    Thanks for the info!