Mixpanel Community Icon

In my unity project, can I set the token manually through script?

·
·

In my unity project, can I set the token manually through script?

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Hi Januar T., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> đź‘‹

    Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Yes, you can set the Mixpanel token manually through script in your Unity project. According to the Unity SDK documentation, there's an option for manual initialization.Here's how you can do it: 1. First, in your Unity project settings, select "Manual Initialization" in the Mixpanel settings.2. Then, in your script, you can call Mixpanel.Init() to initialize Mixpanel with your token. Here's an example of how you might do this in your code: LBKSusing mixpanel;LBKS// Your initialization code Mixpanel.Init("YOUR_TOKEN");LBKSRemember to replace "YOUR_TOKEN" with your actual Mixpanel project token. You can find your token in your Mixpanel project settings.This method allows you more control over when and how Mixpanel is initialized in your Unity project.

    kapa.ai is still learning and improving, please let me know how I did by reacting below.

    ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.

  • Avatar of Januar T.
    Januar T.
    ·
    ·

    kapa.ai this is wrong as Init method doesn't take any parameter

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    Let me check the knowledge base for you again. One moment! đź“š

  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    I apologize for the confusion in my previous response. You are correct, and I thank you for pointing that out. Let me provide you with the correct information based on the knowledge sources.You're right that the Init() method doesn't take any parameters. The correct way to manually initialize Mixpanel in Unity is slightly different. Here's the accurate information: According to the Unity SDK documentation, if you prefer to initialize Mixpanel manually: 1. First, in your Unity project settings (Edit -> Project Settings -> Mixpanel), you should select "Manual Initialization".2. Then, in your script, you can simply call Mixpanel.Init() without any parameters to initialize Mixpanel.Here's the correct code example: LBKSusing mixpanel;LBKS// Your initialization code Mixpanel.Init();LBKSThe token is not passed as a parameter to the Init() method. Instead, you should set your project token in the Unity project settings for Mixpanel before calling Init().Thank you for catching this error. It's important to provide accurate information, and I appreciate the opportunity to correct it.

    kapa.ai is still learning and improving, please let me know how I did by reacting below.

    ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.