klawr icon indicating copy to clipboard operation
klawr copied to clipboard

Eliminate constructors in UObject and UKlawrScriptComponent wrapper classes

Open enlight opened this issue 9 years ago • 1 comments

The constructors in question:

public UObject(UObjectHandle nativeObject)
public UKlawrScriptComponent(long instanceID, UObjectHandle nativeComponent)

Whenever a user subclasses UKlawrScriptComponent they have to write a constructor to pass these parameters to the base class, this is tedious, and these parameters are internal implementation details that most users shouldn't ever worry about. Users shouldn't be forced to write a constructor at all!

enlight avatar Sep 01 '14 16:09 enlight

What you can do is:

  1. a Factory approach with an Initialize method in the base class and make the constructor internal, so it cant be called from other assemblies.
  2. Internal parameterless constructor + Private parameterized constructor with a static generic method + private Initialize. I'll fix something up tomorrow.

Algorithman avatar Sep 01 '15 22:09 Algorithman