Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Using AI in Unity

Discussion in 'Experimental Scripting Previews' started by witchlightning, Jun 25, 2022.

  1. witchlightning

    witchlightning

    Joined:
    Jun 10, 2022
    Posts:
    6
    I've developed an AI that I'd like players to have in a game. This AI uses the MicroSoft botframework and can chat with users on various channels such as Skype, Telegram and the web. I've been trying to connect a Unity project to the AI using the botframework's direct line channel, which can connect with various .Net clients. There doesn't seem to be a way to make this work in Unity. The necessary dlls are not supported. Is there any chance this will be supported in the near future?
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    Can you provide details about what is not supported? I'm not too familiar with these libraries, so I'm unsure how to answer.
     
  3. witchlightning

    witchlightning

    Joined:
    Jun 10, 2022
    Posts:
    6
    These are the libraries I'm using: Universal.Microsoft.Bot.Connector.DirectLine, Universal.Common.Net.WebSocket, Universal.Common.Serialization. I'm using them because I want to connect to a bot I have installed on Azure and DirectLine will handle that connection and has a dependency on .NETStandard 2.0 which I understand is the version that Unity supports out of the box.
    But after I save the files in Visual Studio and go back to Unity I get errors such as:
    Unloading broken assembly Assets/Plugins/Universal.Microsoft.Bot.Connector.DirectLine.dll, this assembly can cause crashes in the runtime
    Unloading broken assembly Assets/Plugins/Universal.Common.Serialization.dll, this assembly can cause crashes in the runtime

    So I'm wondering how to connect with my bot.
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    This error often means those assemblies are compiled against .NET Core or .NET 5 or 6. Are you sure they are compiled against .NET Standard 2.0?
     
  5. witchlightning

    witchlightning

    Joined:
    Jun 10, 2022
    Posts:
    6
    I'm assuming so. The project's configuration is set to .NET Standard 2.1. Screenshot 2022-06-29 064228.png
     
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    Sorry, I'm not asking about the Unity configuration.

    I'm asking if the assembly Assets/Plugins/Universal.Microsoft.Bot.Connector.DirectLine.dll is compiled against .NET Standard 2.0 or 2.1. I suspect that it is not.
     
  7. witchlightning

    witchlightning

    Joined:
    Jun 10, 2022
    Posts:
    6
    This is where I got the dlls, so I suspect they are. :) Screenshot 2022-06-29 132645.png
     
  8. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,930
    Yes, that looks ok. I'm not sure why this error message occurs then. Can you submit a bug report with this project? We may need to investigate it.
     
  9. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,087
    Are you sure you included all deps? Here's a list I quickly made using my nuget builder:
     
    Anthiese likes this.
  10. witchlightning

    witchlightning

    Joined:
    Jun 10, 2022
    Posts:
    6
    Done.
     
  11. witchlightning

    witchlightning

    Joined:
    Jun 10, 2022
    Posts:
    6
    No, I did not add all these dependencies. That's a lot of dlls to add. Actually, I found when it needs a dependency it asks for it, it doesn't throw this error.
     
  12. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,087
    Not always.
     
    Anthiese likes this.