GridMap set_cell_item()

Godot v3.5.3 for Linux 64bit

This code does not cause a syntax error, but meshlib is not set to GridMap.

Please give me some advice.

extends GridMap

func _ready():

	var meshlib = load("res://meshlib/meshlib001.meshlib")

	var itemId : int = meshlib.get_last_unused_item_id()

	
	set_cell_item(1,0,1,itemId)
	print("実行済み")
	

if you want to set MeshLibrary from code into a GridMap
you just:

func _ready():
	var meshlib = load("res://meshlib/meshlib001.meshlib")
	set_mesh_library(meshlib)

Hello zdrmlpzdrmlp.
Thank you for your advice.
I am grateful to you.

I tried the code
set_cell_item() could not set meshlib to GridMap.

There are no syntax errors.

Is there some code missing?
Is there some code that is wrong?

Please give me some advice.

extends GridMap


func _ready():

	var meshlib = load("res://meshlib/meshlib001.meshlib")
	set_mesh_library(meshlib)

	var itemId : int = meshlib.get_last_unused_item_id()
	print("item_id")
	print(itemId)#1

	
	set_cell_item(1,1,1,itemId)
	print("set_cell_item()実行済み")

Screenshot from 2024-05-15 07-49-11

show the scene where you exported it as a meshlib?

Hello zdrmlpzdrmlp.
Thank you for your advice.
I am grateful to you.

How can I export meshlib to scene?

Please give me some advice.
Screenshot from 2024-05-15 07-49-11

here is how
or you want the godot 3 version:

i put the time stamp so you can see directly see how to do it on both videos

Hello zdrmlpzdrmlp.
Thank you for your advice.
I am grateful to you.

I imported meshlib to GridMap
GDScript does not set Cube of meshlib in GridMap.

How can I set a Cube to the GridMap with GDScript?

Please give me some advice.

Screenshot from 2024-05-15 07-49-11