Spotify4Unity icon indicating copy to clipboard operation
Spotify4Unity copied to clipboard

NULL Reference Exception in ExampleDevicesController.cs

Open tahafarooq7 opened this issue 4 years ago • 0 comments

Hi,

I have configured the app according to the instructions. When I hit play and click the "Connect" button in the "MobileScene" I get the following logs:

  1. Spotify4Unity - Recieved Inplicit authorization on Mobile, Expires at '1/1/0001 12:00:00 AM' UnityEngine.Debug:Log(Object)

  2. Spotify4Unity - Successfully connected to the Spotify Web API

  3. Spotify4Unity - Saved auth token to reuse

  4. NullReferenceException: Object reference not set to an instance of an object ExampleDevicesController.OnDevicesChanged (Spotify4Unity.Events.DevicesChanged e) (at Assets/Spotify4Unity/examples/all_controls/scripts/ExampleDevicesController.cs:69) EventManager+<>c__DisplayClass11_0`1[T].<AddDelegate>b__0 (Spotify4Unity.Events.GameEventBase e) (at Assets/Spotify4Unity/api/event_manager/EventManager.cs:63) EventManager.TriggerEvent (Spotify4Unity.Events.GameEventBase e) (at Assets/Spotify4Unity/api/event_manager/EventManager.cs:135) EventManager.Update () (at Assets/Spotify4Unity/api/event_manager/EventManager.cs:188)

The null reference is pointing towards the SpotifyService here: Device activeDevice = m_devices.FirstOrDefault(x => x.Id == SpotifyService.ActiveDevice.Id);

SpotifyService.ActiveDevice is NULL.

I think I am missing something small.

tahafarooq7 avatar Jan 21 '21 22:01 tahafarooq7