When creating new project in Castle editor and adding a Terrain and then running the project gives error:
It is fixed by adding CastleTerrain to the unit’s uses clause.
The error message quite clearly says how to fix it but it could still be a bit confusing that when adding certain components in editor then you also must add correct imports in code for them to work.
Are there any plans to avoid this kind of error in the future?
Indeed, it’s not optimal now – right now you need to extend your uses
clause manually.
Yes, we plan to address it, it is part of the tasks mentioned in roadmap: “3.33. Expose component name for Pascal code”, where it says:
This is also means we’ll edit the uses
clause of unit to make sure all used component classes are registered, and declared, so that declarations in published
section work. This is also something Delphi/Lazarus do. We know the unit of each component, so it should be easy.
The uses
clause of some unit will have to be extended to include all units necessary by components in the design (whether these components are listed in the view’s published
section or not). It would be most optimal to extend the uses
clause of the view unit (so that, if the view is not used in the application, then also the dependencies are not pulled).
P.S. I enhanced now that roadmap item text to be better 
1 Like