Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difficulties to use it #2

Open
solodeveloping opened this issue Nov 15, 2024 · 1 comment
Open

Difficulties to use it #2

solodeveloping opened this issue Nov 15, 2024 · 1 comment

Comments

@solodeveloping
Copy link

Hello,

Thanks for your work :)

I'm making this issue for the sake of improving the project, since I'll be using something else.

I managed to make your examples works in Godot 4.3.

The issues:

  • On installation, we have an error, even after enabling the plugin
  • I did not know if I should give it a class_name or make it a global variable (it seems that you need to make the SoundManager a global)

After that, I tried to create a playlist, added some tracks, but there was an error.

        var my_track = current_playlist.tracks[0]
	current_song = current_playlist.tracks[0]
	print(current_playlist.tracks.size())
	
	if is_crossfading:
		_change_with_crossfade(current_song)
	else:
		stop_music.emit()
		music_player.stream = current_song.track
		music_player.volume_db = 0.0
		music_player.play()

I edited the code to debug it.

The editor thinks that current_song is nill, even though my_track is not nil and there are tracks.

The exact error is "Invalid access to property or key 'track' on a base object of type 'Nil'.".

We usually have this error, in this way, when the type of the variable is wrong, but I definitevely have a MusicTrack here.

I'm emitting the event this way:

music_manager.play_playlist.emit(
  main_loop_playlist, true, false, false, 1
)

And the playlist is a property of my class, @export var main_loop_playlist: MusicPlaylist

I also tried to restart Godot.

Thank you in advance,

@mefjak
Copy link

mefjak commented Dec 1, 2024

The issue is in _on_stop_music() - in the end there is

current_song = null

And in that else statement there is stop_music.emit()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants