mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 21:22:48 +00:00
Updated tutorial_scripting (markdown)
parent
83bc4c7b52
commit
a2dfd3f991
@ -105,14 +105,6 @@ get_node("Button")
|
||||
|
||||
```
|
||||
|
||||
**Note:** get_node(path) works by returning the immediate children to the node controlled by the script (in this case, _Panel_), so _Button_ must be a child of _Panel_ for the above code to work. To give this clarification more context, if _Button_ was a child of _Label_, the code to obtain it would be:
|
||||
|
||||
```python
|
||||
# not for this case
|
||||
# but just in case
|
||||
get_node("Label/Button")
|
||||
```
|
||||
|
||||
So, next, a callback will be added for when a button is pressed, that will change the label's text:
|
||||
|
||||
```python
|
||||
@ -155,6 +147,13 @@ Running the scene should have the expected result when pressing the button:
|
||||
|
||||
<p align="center"><img src="images/scripthello.png"></p>
|
||||
|
||||
**Note:** As it is a common mistake in this tutorial, let's clarify again that get_node(path) works by returning the immediate children to the node controlled by the script (in this case, _Panel_), so _Button_ must be a child of _Panel_ for the above code to work. To give this clarification more context, if _Button_ was a child of _Label_, the code to obtain it would be:
|
||||
|
||||
```python
|
||||
# not for this case
|
||||
# but just in case
|
||||
get_node("Label/Button")
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user