Objects and Referencing

[NOTE: This is mostly condensed information from the Unreal Online Documentation so I can get a quick reference from]

    Objects are basically anything you can load in Unreal Engine and are the most basic class. They act like building blocks and contain a lot of the essential functionality for your Assets. Almost everything in Unreal Engine inherits (or gets some functionality) from an Object. Basically, collections of data and functionality. These Objects can be an Actor, a Material, Lights, Components, etc...

   The base class for objects in Unreal is UObject. The UCLASS macro can be used to tag classes derived from UObject so that the UObject handling system is aware of them. 

   Method NewObject<class> Creates a new instance with optional parameters for all available creation options. Offers a wide range of flexibility, including simple use cases with an automatically generated name.

   The keyword new can be used used to construct Objects in certain low level circumstances, such as when the constructor requires arguments.

   For updating Objects, Ticking refers to how Objects are updated in Unreal Engine. All Objects have the ability to be ticked each frame, allowing you to perform any update calculations or actions that are necessary. Objects do not possess any built-in update ability; however, this ability can be added when necessary by inheriting from the FTickableGameObject class using the inherits class specifier. They can then implement the Tick() function, which will be called each frame by the Engine. Note that most in-game Objects will be ???, which can tick at user-set minimum intervals rather than once per frame. 

   Object destruction is handled automatically by the garbage collection system when an Object is no longer referenced. This means that no UPROPERTY pointers, or engine containers or smart pointer class instances should have any strong references to it. When the garbage collector runs, unreferenced Objects that are found will be deleted. In addition, the function MarkPendingKill() can be called directly on an Object, and this function will set all pointers to the Object to NULL, as well as remove the Object from global searches. Once again, the Object will be fully deleted on the next garbage collection pass. Note that Weak Pointers have no impact on whether an Object is garbage collected or not.


REFERENCING OBJECTS

   Instead of copying objects around, use a reference to the object's address. Example: Add a Cube to your level, select that Cube, go back to the event graph canvas of your blueprint, right click and select from the functionality window -> Create a Reference to Cube. It will create a new node that you can get the reference to the Cube from. So when you drag off the output data pin, you can basically access all the functionality that Cube has. For example, you could get the Cube's static mesh component.