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

Create an AudioStreamPlayer when an AudioStream is dropped into the scene #9699

Closed
passivestar opened this issue May 8, 2024 · 3 comments · Fixed by godotengine/godot#92004
Milestone

Comments

@passivestar
Copy link

Describe the project you are working on

Quick game prototypes

Describe the problem or limitation you are having in your project

Adding sounds to the game could be a bit quicker

In Unity dropping a sound file into the hierarchy automatically creates a player for it. This QOL feature is convenient for quick game prototypes where you're not using any kind of a centralized audio manager singleton to play streams through, or if you're purposefully avoiding having such a singleton if you're trying to make game entities more self-contained

Describe the feature / enhancement and how it helps to overcome the problem or limitation

When you drop an AudioStream resource from the FileSystem dock onto a node in the Scene dock or into the viewport it would automatically create an appropriate AudioStreamPlayer node and set its stream property to that resource

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

The type of the node would depend on where you're dropping the stream:

  • Dropping onto a node derived from Node3D or into the 3D viewport would create an AudioStreamPlayer3D
  • Dropping onto a node derived from Node2D or into the 2D viewport would create an AudioStreamPlayer2D
  • Dropping anywhere else would create an AudioStreamPlayer

If this enhancement will not be used often, can it be worked around with a few lines of script?

Not in a few

Is there a reason why this should be core and not an add-on in the asset library?

A small QOL editor feature

@mieldepoche
Copy link

mieldepoche commented May 8, 2024

afaik dropping a resource on a node in the tree usually means "set a property": for example dropping a texture on a Sprite2D, or an AudioStream on an AudioStreamPlayer (or any node that has an AudioStream property).

Dropping an `AudioStream` on a node that has an `AudioStream` property
simplescreenrecorder-2024-05-08_10.31.14.mp4

@passivestar
Copy link
Author

@mieldepoche it could keep the old behavior if the node has a stream property and add a new node if it doesn't

@KoBeWi
Copy link
Member

KoBeWi commented May 8, 2024

We could enable dropping in between nodes when dragging resource. Right now you can drop only on top of node.

4rOpCi0fbO.mp4

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

Successfully merging a pull request may close this issue.

4 participants