- Home /
Does LibSpotify SDK crashes Unity3D?
The past few days im trying to integrate music streaming services (Spotify and Deezer) in Unity3D. Starting with the libspotify SDK written in C for Win32:
But with no luck. I have tried different C# wrappers like libspotifydotnet and libspotify-sharp. But all implementations ends with the same result, which is crashing Unity3D.
The following error occurs when using the libspotify-sharp wrapper (crashing unity): But the libspotify.dll IS in the /Assets/plugins/ folder (path is also correct in the error message!).
Besides the wrapper, i also tried using the libspotify.dll in /Assets/plugins/ directly by creating a simple C# script which imports the libspotify.dll and mapped two functions with it according to the Unity plugins tutorial with the functions described in the documentation of libspotify like so:
using System;
using System.Runtime.InteropServices;
using UnityEngine;
public class TestSpotify : MonoBehaviour
{
[DllImport ("libspotify")]
public static extern string sp_error_message (sp_error error);
[DllImport ("libspotify")]
internal static extern sp_error sp_session_login (IntPtr sessionPtr, string username, string password);
void Start ()
{
Debug.Log ("result of native lib is : " + sp_error_message (sp_error.OK));
}
#region Enums
public enum sp_error
{
OK = 0,
BAD_API_VERSION = 1,
API_INITIALIZATION_FAILED = 2
}
#endregion
}
Is my approach wrong? (is the libspotify.dll at the wrong location or do i miss some .NET skills and insights?) because this code also results in the DllNotFoundException.
And who succeeded with implementing the libspotify SDK anyway? because the total amount of information on the internet is like a fart in the wind.. so, any unityproject would be very much appreciated :).
I'm using Unity3D pro and MonoDevelop as development environment.
Were you able to find anything with this? I seem to be having the same issue.
Thanks so much, Greg
nnnoope, could not get it started. I have tried posting different threads on answers/forum.unity3d and stackoverflow, but still no response... i would gladly help to realize this though.
I'm now using local files combined with local and online music analytics.
Answer by indiegamerdev · Mar 19, 2015 at 01:53 PM
Try downloading the latest dll from the linspotify site that seemed to work for me I'm also running 32 bit unity. Good luck!
Answer by SoylentGraham · Aug 17, 2015 at 04:12 PM
DLLNotFoundException can often refer to the DLL's dependancies.
Find Dependancy walker (http://www.dependencywalker.com/) and open libspotify.dll and see if there are any extra DLL's it might need. These then need to be placed in the same place as your "plugin"'s DLL.
It could also be 32 vs 64 bit.
Try attaching the visual studio debugger to unity BEFORE the first attempt to load the plugin and it should give you some extra information (like the 32 vs 64 bit error)
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Speaker/earphone audio output toggle from unity c# script using "Lesser AudioSwitch" app 0 Answers
Custom Inspector for Hex Editor? 0 Answers
NullReferenceException in a wrapper 0 Answers