altmp / coreclr-module

CoreClr (.NET Core Common Language Runtime) community made module
MIT License
15 stars 7 forks source link

TextLabel not removed after destroy #15

Closed TuK4z closed 4 months ago

TuK4z commented 5 months ago

Alt TextLabel api has two issues. One that I i did not created any TextLabels it still gets some unknown labels (Alt.GetAllTextLabels and if you remove and create text label it takes used label id it could be the main issue with those Random created labels. I made this with VirtualEntity on streamIn StreamOut

Create label:

ITextLabel textLabel = Alt.CreateTextLabel($"iNFO {InfoData}", "Arial", 30, 1, entity.Position, new Rotation(0,0,0), new Rgba(255, 255, 180, 180), 0, new Rgba(0, 0, 0, 0), false, 0);
textLabel.IsFacingCamera = true;
Alt.Log($"Created TextLabel Id {textLabel.Id} | Remote: {textLabel.RemoteId}");
entity.SetMetaData("LabelId", textLabel.Id);

Remove label:

entity.GetMetaData("LabelId", out uint lebelId);
Alt.Log($"Remove Text Label {lebelId}");

foreach (ITextLabel label in Alt.GetAllTextLabels())
{
    Alt.Log($"label Id {label.Id} | Remote: {label.RemoteId}");
    if(label.Id == lebelId)
    {
        label.Destroy();
        Alt.Log($"REMOVED");
    }
}

For example after game launched i entered streaming range of virtualentity and created label then exit streaming range and removed label, but it stayed visible and logs can tell there is more labels that i did not created image

When i try to create again it gives ID 2 and still on exit it wont remove label from game. image image

Doxoh commented 5 months ago

on js works without problems?

TuK4z commented 5 months ago

Yep, JS don't have those premade textlabels.

Doxoh commented 4 months ago

should be fixed in 16.1.0-dev.5 pls test again