Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Yeldham | |
Old Version | Published before Godot 3 was released. |
Is there a way to use a function of another script with setget?
The best way to answer that would be to try it, e.g.:
var some_prop = 0 setget preload("res://other_script.gd").some_method,
But I think it will probably not work. I’m curious about why you’d need that though, usually setters and getters are for the given class’ variables.
Akien | 2017-10-19 12:06
I want to make that some variables can’t be accessed externally, so I use setget with a function that just prints that an attempt to access them is being made. The problem is, is quite annoying to write the same function in all scripts that I want to do this, so I tried to put the function on my game manager singleton, to no success.
And no, preloading didn’t work.
Yeldham | 2017-10-19 13:21