Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Integrating Teamspeak SDK C# Sample in Unity

Discussion in 'Scripting' started by Lisi, Jul 17, 2014.

  1. Lisi

    Lisi

    Joined:
    Apr 8, 2014
    Posts:
    22
    HI!
    I have the following problem: I have put the SDK C# Sample files in Unity. I have made one project for the Client and one for the Server.
    I have made in both Server and Client Sample in the "Program.cs" Script the following modifications: I have written above the whole script
    using UnityEngine;
    and then I modified the following part: instead of having

    class Program{
    static void main(string [] args){

    I wrote:

    public class Program:MonoBehaviour{
    void Start{

    Then I attached the script to my MainCamera.
    Now when I am only starting the Client without Server the following Callback Function should be called and a textfile should be written with the same text as it would stand in the consol window in Visual Studio, but it never jumps in that function. Also when I am making a breakpoint in that function.

    public static void onConnectStatusChangeEvent(uint64 serverConnectionHandlerID, int newStatus, uint errorNumber)
    {
    Console.WriteLine("Connect status changed: {0} {1} {2}", serverConnectionHandlerID, newStatus, errorNumber);
    /* Failed to connect ? */
    if (newStatus == (int)ConnectStatus.STATUS_DISCONNECTED && errorNumber == public_errors.ERROR_failed_connection_initialisation) {
    Console.WriteLine("Looks like there is no server running, terminate!");

    StreamWriter myFile = new StreamWriter("audio.txt");
    myFile.Write("Looks like there is no server running, terminate!");
    myFile.Close();

    Console.ReadLine();
    System.Environment.Exit(-1);
    }
    }



    How do I have to adapt the sample scripts so that they are doing the same in Unity as in Visual Studio?

    Thanks a lot.
    Hope someone can help me :)
     
  2. smitchell

    smitchell

    Joined:
    Mar 12, 2012
    Posts:
    702
    Please use code tags. your code is unreadable like that
     
  3. Lisi

    Lisi

    Joined:
    Apr 8, 2014
    Posts:
    22
    Hi!
    I have found now a solution.
    Thanks.
     
  4. Michael Geary

    Michael Geary

    Joined:
    Jun 23, 2014
    Posts:
    1
    Could you share your solution, maybe even a complete code example, for those of us who would like to do something similar?

    Thanks!
     
  5. worla

    worla

    Joined:
    Jan 16, 2015
    Posts:
    5
    hi, can you please share your code with us. I want to integrate teamspeak in my application. I would be really happy if you can share code and explain it to us. thank you in advance
     
  6. worla

    worla

    Joined:
    Jan 16, 2015
    Posts:
    5
    Hi Lisi, i want to add a voice chat to my application and i wan to Teamspeak SDK, but i don't really know what to do. I have downloaded the Teamspeak SDK. Please i really need you help on this one. It seems you are the only one who have done this successfully. thank you
     
  7. Lisi

    Lisi

    Joined:
    Apr 8, 2014
    Posts:
    22
    Hi!
    I will put the solution here on friday if that is okay because I am not at home the next days.
    Best
    Lisi
     
  8. Lisi

    Lisi

    Joined:
    Apr 8, 2014
    Posts:
    22
    And a question: is there any Option to activate notification? I never get notifications when someone answers to my posts. I saw the replay by coincidence. And where can I see all my posts?
    Cheers
     
  9. landon912

    landon912

    Joined:
    Nov 8, 2011
    Posts:
    1,579
    Hit "watch thread" in the top right.
     
  10. Lisi

    Lisi

    Joined:
    Apr 8, 2014
    Posts:
    22
    Hi!
    Sorry for the late answer.
    First you have to drag and drop the following scripts from the example into Unity: "callbacks.cs", client_publicdefinitions.cs, ProgramClient.cs, public_definitions.cs, public_errors.cs, Program_Server.cs and CallbacksServer.cs (CallbacksServer.cs is the callbacks.cs file from the server example, but you have to rename it that it works). Further you have to drag and drop the include and libary folder into Unity and also all the dlls and drag and drop all the dlls also in your Unity Editor folder at C:\Program Files (x86)\Unity\Editor.
    Then you have to do some modifications:
    In callbacks.cs, Callbacksserver.cs, ProgramClient.cs and in the ProgramServer.cs write at the beginning:

    using UnityEngine;
    using ts3client_minimal_sample;

    In the ProgramClient.cs example replace
    public class ProgramClient{
    by:
    public class ProgramClient:MonoBehaviour{

    and
    class ts3client{
    by
    class ts3client:MonoBehaviour{

    Do this also in the ProgramServer.cs. In the ProgramServer.cs write also:
    public class ProgramClient:MonoBehaviour{
    and
    class ts3server:MonoBehaviour {

    Make also sure that in ProgramClient the Teamspeak Client gets started in the Start Function and that it gets destroyed in the onApplicationQuit function. Just copy and paste the original code in this two functions.
    Also do this in ProgramServer with the Teamspeak Server.

    I hope this helps. It's a long time since I integrated it. Hope I explained all steps. If not and something does not work just answer.

    Best,
    Lisi
     
  11. chaozz

    chaozz

    Joined:
    Dec 9, 2012
    Posts:
    48
    Will this work on the Free version of Unity 4?
     
  12. carmine

    carmine

    Joined:
    Jan 4, 2012
    Posts:
    394
    Hello, where did you even find TeamSpeak SDK for C# ? The one I download from their site is all in .C

    Thanks!
     
  13. VRtube

    VRtube

    Joined:
    Nov 16, 2014
    Posts:
    2
  14. thorwe_ts

    thorwe_ts

    Joined:
    Apr 21, 2016
    Posts:
    1