Soundcloud Unity by oddruud - 2


soundcloud unity client code for getting track comments

Unknown VersionUnknown LicenseUpdated 5 years agoCreated on June 17th, 2015
Go to source


Want to use soundcloud comments in your unity game? look no further. soundcloud-unity interfaces with the soundcloud http api and generates a SoundCloundTrack Value Object with comments.


Attach the SoundCloudService behaviour to a game object. Fill in your SoundCloud developer clientId in the ‘clientId’ field.

Now load a track as such:

public string TrackId; //the identifier of the track on SoundCloud. 

SoundCloudTrackLoader theLoader = _soundCloudService.createTrackLoader();
theLoader.TrackLoaded += HandleTrackLoaded;
theLoader.LoadingError += HandleLoadingError;
theLoader.load(TrackId, false);

Example TrackLoaded Handler:

protected void HandleLoadingError (SoundCloudTrackLoader aSoundCloudTrackLoader) {
	aSoundCloudTrackLoader.LoadingError -= HandleLoadingError;
	Debug.Log("failed to load soundcloud track: " + aSoundCloudTrackLoader.TrackId);
	//Do something with this error

Example LoadingError Handler:

protected void HandleTrackLoaded (SoundCloudTrackLoader aSoundCloudTrackLoader) {
	aSoundCloudTrackLoader.TrackLoaded -= HandleTrackLoaded;
	//Do something with the aSoundCloudTrackLoader.soundCloudTrack Value Object.
Show all projects by oddruud