Start all over again

Ok, I started from scratch again and the only thing I added in design was an ImageTransform.
But it horribly crashes. What is wrong, is there something broken in CGE?

First guess: Did you delete FPS Label? If yes, then also remove using it from the code (in TStateMain.Update).

No, I started an empy project and tried also 2D template.
Now when I start a new project with different project name it works ok.
Maybe there is something left of my previous project in app data?

Never mind. It works again.
I did not remove FPS label; it did not show up in the first place, but now it does.
Strange.

1 Like

Hm, the first screenshot you show in this thread shows missing LabelFps. I mean it is missing on the hierarchy on the left on your screenshot. Ant this explains the crash you show, i.e. without LabelFps there will indeed be a crash at line

LabelFps.Caption := 'FPS: ' + Container.Fps.ToString

I double-checked now and all templates contain it… So this does suggest that you have removed it by accident.

If you’re starting all over again I would heavily suggest to learn to use version control and put your project on GitHub / GitLab etc. This will allow to answer such things with confidence, you will always have “previous version of the project that worked” etc.

I have added

Assert(LabelFps <> nil, 'If you remove LabelFps from the design, remember to remove also the assignment "LabelFps.Caption := ..." from code');

to all templates now, so if you remove LabelFps you will get a more obvious error message as per above (in the debug build).

1 Like

I am not really starting all over again; I used your 2D template as starting point and then copied my previous cge editor design over the dragon design (yes, and removed LabelFps from gamestateplay :-).
Now I will copy the working types and procedures 1 by 1 from my old gamestateplay code to the template gamestateplay, while compacting and splitting large procedures where I can and then running the code again.
On the process I already discovered why ImageTransform in published TState gave an error (my other topic); this was because I declared WestbeachTransform as var in another procedure after TState.