Godot Version
4.2.2 stable
Question
I’m trying to access script right after instantiation and says I’m in static so wth what can I do or what is the correct way?
this is where I’m calling the instantiation:
extends Node3D
func _ready():
var instance = preload("res://Scenes/Player2.tscn").instantiate()
var s = instance.get_script()
s.SetCamera() #E 0:00:00:0522 planet.gd:25 @ _ready(): Can't call non-static function 'SetCamera' in script.
#<C++ Error> Condition "!E->value->is_static()" is true. Returning: Variant()
#<C++ Source> modules/gdscript/gdscript.cpp:853 @ callp()
#<Stack Trace> planet.gd:25 @ _ready()
what is the correct way of accesing it’s script?
this is what I’m trying to call
func SetCamera():
print("in camera")
if this works I can change it’s values later on
so it must not be static.