This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I have some problems with controlling music in the game options and can't find way out. it works normal until player click the button '+' or '-'
Maybe i do something wrong?

 extends Button
func _pressed():
    var node = get_node("Control/music/Slider")

    if(name == "minus"):
        node.set_value(node.get_value() - node.step)
    else: 
        node.set_value(node.get_value() + node.step)

    var dbVolue = node.value
    AudioServer.set_bus_volume_db(AudioServer.get_bus_index(get_node("Control/music").name), dbVolue)
    get_node("Control/SFX/AudioStreamPlayer").play()
Godot version 3.2.3 stable
in Engine by (32 points)

1 Answer

+1 vote
Best answer

That is telling you that node is a "null instance. That means that get_node("Control/music/Slider") is not a returning a valid node, probably because the node path is incorrect.

You need to use the correct path from this Button node to the "Slider" node. I can't tell you what that is because I can't see your scene tree.

See here for an explanation of node paths: http://godotrecipes.com/basics/getting_nodes/

by (22,191 points)
selected by
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.