christian.wolf2 Posted April 16, 2023 Posted April 16, 2023 Hi UNIGINE-Team, it would be nice if the current ComponentSystem would support abstract classes so the user can't be attached that classes to any nodes/surfaces in order to allow a more convenient code paradigm. When currently using somethin like "public abstract class MyClass : Component", the dotnet.exe in the editor crashed, VS-console will give you a little bit more info: 1>CSPropertyGenerator started 1>Unhandled exception. System.MissingMethodException: Cannot dynamically create an instance of type 'MyAbstractClass'. Reason: Cannot create an abstract class. 1> at System.RuntimeType.ActivatorCache..ctor(RuntimeType rt) 1> at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) 1> at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions) 1> at System.Activator.CreateInstance(Type type) 1> at Unigine.ComponentClassData.SaveProperty(String file_name) 1> at Unigine.ComponentSystem.SaveProperties() 1> at UnigineUtils.CSPropertyGenerator.Main(String[] args) in D:\BA\work\16e2ac2576e002c0\source\csharp\tools\CSPropertyGenerator\main.cs:line 108 Maybe adding at least an short "type.GetTypeInfo().IsAbstract;" would deal with the crash at the moment. Best Christian
silent Posted April 17, 2023 Posted April 17, 2023 Hi Christian, Yes, abstract classes are not supported currently. We would think how to properly add this feature into in the future updates. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Recommended Posts