C
C#12mo ago
ZSolarDev

This function won't run for some reason

I have a function in an object thats a class named Sprite. in another class thats not an object called BaseState, It has a list of Sprites. It goes through the list of Sprites and draws these sprites to the screen, and that works fine. I tried to make a function in the Sprite class called Update, and it's supposed to log a passed argument called elapsedMilliseconds. But for some reason it doesnt log anything. I even changed it to log the text "TEST", but it still doesnt log anything. There aren't any errors, no crashes, no nothing. this is the code for handling Sprites:
for (int i = 0; i < sprList2D.Count; i++){
sprList2D[i].Update(elapsedMilliseconds);
if (sprList2D[i].visible){
Raylib.DrawTexture(sprList2D[i].tex, sprList2D[i].x, sprList2D[i].y, sprList2D[i].tint);
}
}
for (int i = 0; i < sprList2D.Count; i++){
sprList2D[i].Update(elapsedMilliseconds);
if (sprList2D[i].visible){
Raylib.DrawTexture(sprList2D[i].tex, sprList2D[i].x, sprList2D[i].y, sprList2D[i].tint);
}
}
Here is the Update function:
public void Update(float elapsedMilliseconds){
Console.WriteLine("TEST");
}
public void Update(float elapsedMilliseconds){
Console.WriteLine("TEST");
}
The list clearly isnt empty bc the one sprite that's there is drawing correctly. Any help?
8 Replies
Jimmacle
Jimmacle12mo ago
have you used the debugger to verify that your variables are in the state you think they are?
ZSolarDev
ZSolarDevOP12mo ago
no, ive never used a debugger before oh I just found out it works but it just doesnt log anything I changed the sprites x to 0 and it changed but it doesnt log
Jimmacle
Jimmacle12mo ago
$details
MODiX
MODiX12mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Jimmacle
Jimmacle12mo ago
what environment is this? do you actually have a console?
ZSolarDev
ZSolarDevOP12mo ago
vscode also yes i do
Jimmacle
Jimmacle12mo ago
does other console printing work?
ZSolarDev
ZSolarDevOP12mo ago
I just tried printing in another class that works and no it wont print
Want results from more Discord servers?
Add your server