sprite not show in another scene (c#)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By quangtran

Something wrong but I don’t know where is, just simple some lines code, but nothing sprite show, thank for reading my post

    var scene = (PackedScene)GD.Load("res://Node2D.tscn");
    Node main_node = scene.Instance();
    texture = (Texture)GD.Load("res://asset/images/tri_32.png");       
    sprite = (Sprite)main_node.GetNode("tri8");
    sprite.Texture = texture;
    var v = new Vector2(100,100);
    sprite.Position = v;   
    main_node.AddChild(sprite);
:bust_in_silhouette: Reply From: miskotam

Use ResourceLoader:

texture = ResourceLoader.Load<Texture>("res://asset/images/tri_32.png");