SkookumScript-only Classes


#1

I first created a Blueprint class that derives from UObject, but data members of the class’ type weren’t visible in SkookumScript even though the class itself was. Assuming this is a technical restriction, I decided to create the class in Sk, so I had a few questions in mind:

  • Does it make more sense for the class to inherit from Object or Entity if it doesn’t need Actor functionality?
  • How are SkookumScript Objects managed? Are they still garbage-collected?

#2

If you are using this class solely in SkookumScript, and are not creating actual UObjects from it, you don’t need a BP class at all, and can simply create your class inside the IDE. In this case, of course you would derive from the base class with the minimum required functionality, possibly even just the SkookumScript Object.

When using BP classes, SkookumScript is best supported on Actor derived classes. Using BPs directly derived from UObject is still a bit of uncharted territory with Sk. We’ll look into it and get back to you though.

SkookumScript objects are immediately freed when they are no longer needed. There is no garbage collector that runs at unpredictable times.


#3

SkookumScript uses automatic reference counting (ARC) as its primary memory management mechanism (similar to Swift and Objective-C). ARC differs from traditional more complex garbage collection in that it runs no background process that deallocates the objects asynchronously at runtime—instead, whenever an object has no references, its destructor is called and any cleanup is performed immediately.

Whenever an object is bound to a variable, appended to a list, passed as an argument, has a routine called on it, etc. it increments its reference count and then it will decrement its reference count when the variable goes out of scope, the routine completes, etc.


#4

Thank you both for your answers. I realised later that I don’t need to access this class from Blueprint, so creating it in the IDE wasn’t a problem.