![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Benova |
im adding some nodes (lables,containers etc…) via add_child
and when i run the project everything looks fine.
but on the executable i cant see those newly added nodes…
extends Control
func _ready():
var gamesScrollingList = $MainContainer/ScrollContainer/GamesList
var gamesList = get_from_json("GamesList.json")
for game in gamesList:
var gameContainer = CenterContainer.new();
var gameContentContainer = VBoxContainer.new()
gameContentContainer.set("custom_constants/separation", 20)
var labelToAdd = Label.new()
labelToAdd.text = "Name: " + game.name
labelToAdd.align = Label.ALIGN_CENTER
var imgToAdd = TextureRect.new()
imgToAdd.texture = getImage(game.cover)
gameContentContainer.add_child(labelToAdd)
gameContentContainer.add_child(imgToAdd)
gameContainer.add_child(gameContentContainer)
gamesScrollingList.add_child(gameContainer)
print_tree()
func get_from_json(filename):
var file = File.new()
file.open(filename, File.READ)
var text = file.get_as_text()
var data = parse_json(text);
file.close()
return data
func getImage(imagePath):
var img = Image.new()
var itex = ImageTexture.new()
img.load("res://gfx/"+imagePath)
img.resize(300,300);
itex.create_from_image(img)
return itex
this is in the engine(the scroller on the right side):
but in the exe its missing the scroller and the pics:
A screenshot would be nice. I’d tell you for the looks of it you don’t have the json file generated near your executable.
jtarallo | 2020-06-09 23:13
are you adding *.json files to the non-resources export list?
davidoc | 2020-06-10 01:02
yap…
Benova | 2020-06-10 13:24