system
1
|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
Castor1010 |
can anyone pls help
i stiil get this message:
Nonexistent function instance in base ‘GDscript’
this is the script
extends Panel
var item = null
var ItemClass = preload(“res://Item.gd”)
func _ready():
if randi() % 2 == 0:
add_child(item)
item = ItemClass.instance()
system
2
|
|
|
|
Reply From: |
yrtv |
var ItemClass = preload("res://Item.gd")
itemClass now has type GDScript.
ItemClass.instance()
GDScript
does not have instance()
method.
Without additional context answer end here. What are you trying to do?
system
3
|
|
|
|
Reply From: |
Scavex |
var ItemClass = preload("res://Item.gd")
Take a good look. Here you need to preload a scene not a script ! Even in the tutorial it’s
var ItemClass = preload("res://Item.tscn")