Open
Description
Tested versions
4.4.1
System information
windows 11- godot 4.4.1
Issue description
Node2D draw_string in gdscript or DrawString in C# dosen't work in godot 4.4.1
extends Node2D
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _draw():
var font = FontFile.new()
font = load("res://font/simkai.ttf")
draw_string(font, Vector2(100, 100), "Hello, Godot 4!")
or
using Godot;
using System;
public partial class main : Node2D
{
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
public override void _Draw()
{
base._Draw();
FontFile font = new FontFile();
font=GD.Load<FontFile>("res://font/simkai.ttf");
this.DrawString(font,new Vector2(0,0),"你好",HorizontalAlignment.Left,-1,32,Colors.Red);
}
}
Steps to reproduce
Node2D draw_string in gdscript or DrawString in C# dosen't work in godot 4.4.1
extends Node2D
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _draw():
var font = FontFile.new()
font = load("res://font/simkai.ttf")
draw_string(font, Vector2(100, 100), "Hello, Godot 4!")
or
using Godot;
using System;
public partial class main : Node2D
{
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
public override void _Draw()
{
base._Draw();
FontFile font = new FontFile();
font=GD.Load<FontFile>("res://font/simkai.ttf");
this.DrawString(font,new Vector2(0,0),"你好",HorizontalAlignment.Left,-1,32,Colors.Red);
}
}
Minimal reproduction project (MRP)
can't upload
Bugsquad edit: Fix code block formatting.