![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | javier |
Hello. I have doubts regarding the static language in the Godot engine.
var numero : int = 5
I understand that above I have the variable called “numero” and that throughout the game, it will have an integer value (5), right? good. But what if I just do this?
var numero : int
What value does the variable “numero” have? Does it initialize itself? Now, thinking that this is the case and that it will have a value of zero, I have no problem. But what about this?
var camara : Camera
What value does this variable have? or how can i initialize it?
Why am I asking this? I’ve seen some examples where they show this:
var scene:PackedScene = load("resources//... etc")
I understand this part:
var scene:PackedScene
But I don’t understand this part anymore:
= load("resources//... etc")
Does this part initialize the variable? But what if it doesn’t initialize at first? Then how do I initialize it?
But what if it doesn’t initialize at first? Then how do I initialize it? I can do this?
scene = load("resources//... etc")
Thanks for your help.
after load or preload, you’ll still need to instance and add it. the typing just makes it harder for you to make inconsistencies in your code that may lead to errors in large projects. just a real strict code checker… apparently it does improve the performance and improves code completion and other stuff…
CassanovaWong | 2023-03-22 12:56