mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
Update all instances of instance() to instantiate()
This commit is contained in:
@@ -192,7 +192,7 @@ loader.
|
||||
|
||||
|
||||
func set_new_scene(scene_resource):
|
||||
current_scene = scene_resource.instance()
|
||||
current_scene = scene_resource.instantiate()
|
||||
get_node("/root").add_child(current_scene)
|
||||
|
||||
Using multiple threads
|
||||
@@ -285,7 +285,7 @@ Example:
|
||||
start_cutscene()
|
||||
|
||||
# Later, when the user presses the pause button for the first time:
|
||||
pause_menu = queue.get_resource("res://pause_menu.tres").instance()
|
||||
pause_menu = queue.get_resource("res://pause_menu.tres").instantiate()
|
||||
pause_menu.show()
|
||||
|
||||
# When you need a new scene:
|
||||
|
||||
@@ -241,7 +241,7 @@ load function:
|
||||
var node_data = json.get_data()
|
||||
|
||||
# Firstly, we need to create the object and add it to the tree and set its position.
|
||||
var new_object = load(node_data["filename"]).instance()
|
||||
var new_object = load(node_data["filename"]).instantiate()
|
||||
get_node(node_data["parent"]).add_child(new_object)
|
||||
new_object.position = Vector2(node_data["pos_x"], node_data["pos_y"])
|
||||
|
||||
@@ -282,7 +282,7 @@ load function:
|
||||
|
||||
// Firstly, we need to create the object and add it to the tree and set its position.
|
||||
var newObjectScene = (PackedScene)ResourceLoader.Load(nodeData["Filename"].ToString());
|
||||
var newObject = (Node)newObjectScene.Instance();
|
||||
var newObject = (Node)newObjectScene.Instantiate();
|
||||
GetNode(nodeData["Parent"].ToString()).AddChild(newObject);
|
||||
newObject.Set("Position", new Vector2((float)nodeData["PosX"], (float)nodeData["PosY"]));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user