0 votes

Is there some function like:

var x = getstreamname()

in Godot and how to use them?

in Engine by (96 points)

1 Answer

+3 votes

If you want the full path of the stream:


If you are only interested in the filename:


If you want to remove the file's extension:

by (10,523 points)

Thank you very much, but I need to find out the name of the node. The thing is, I have 100 audio streams and in one function I select one to play according to a certain key. And I need to find out the name of the selected stream retrospectively (in another function).

I need to find out the name of the node
I need to find out the name of the selected stream

What now? The name of the node (Which node? The AudioStreamPlayer-node?)? That's simple: $AudioStreamPlayer2D.name. Or the name of the stream? That's what I have described in my answer. Not sure what else you might be looking for...

If you want to keep track of which AdioStreamPlayer-node is playing, simply save the active node to a variable and access it through that variable. It's hard to provide you with concrete advice regarding that without knowing your code though.

print( $AudioStreamPlayer.get_name() )
I've already solved it yet, but thank you very much!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.