Keywords: UE4, UObject, Construct, Construction, Instantiating, UObject-derived

Different ways to instantiate the object
  • UObject::CreateDefaultSubobject is only callable in a class constructor, and takes care of creating an instance of the CDO of the subobject’s class, setting its outer class as the caller object, among other things. The created object then becomes the default object for the property when its object class is instantiated.

  • NewObject<T> is the function normally used to instantiate objects after engine initialisation, during normal gameplay. It provides several convenience overloads to handle most scenarios.

  • UWorld::SpawnActor<T> is a convenience method to spawn actors in a level with the specified location and rotation, spawn collision settings, and checks to ensure it’s a spawnable actor class, and is nothing more than a wrapper of NewObject.

  • ConstructObject has been removed in favour of NewObject.

Orign:
Unreal Engine 4. Different ways to instantiate the object
https://stackoverflow.com/a/60030248/1645289

Check Types

Class:

UClass::IsChildOf();

Actor:

AActor::IsA();
Initialize members of UObject from ini configuration file

Engine\Source\Runtime\CoreUObject\Public\UObject\Object.h

/**
 * Imports property values from an .ini file.
 *
 * @param	Class				the class to use for determining which section of the ini to retrieve text values from
 * @param	Filename			indicates the filename to load values from; if not specified, uses ConfigClass's ClassConfigName
 * @param	PropagationFlags	indicates how this call to LoadConfig should be propagated; expects a bitmask of UE4::ELoadConfigPropagationFlags values.
 * @param	PropertyToLoad		if specified, only the ini value for the specified property will be imported.
 */
void LoadConfig( UClass* ConfigClass=NULL, const TCHAR* Filename=NULL, uint32 PropagationFlags=UE4::LCPF_None, class UProperty* PropertyToLoad=NULL );

/**
 * Wrapper method for LoadConfig that is used when reloading the config data for objects at runtime which have already loaded their config data at least once.
 * Allows the objects the receive a callback that it's configuration data has been reloaded.
 *
 * @param	Class				the class to use for determining which section of the ini to retrieve text values from
 * @param	Filename			indicates the filename to load values from; if not specified, uses ConfigClass's ClassConfigName
 * @param	PropagationFlags	indicates how this call to LoadConfig should be propagated; expects a bitmask of UE4::ELoadConfigPropagationFlags values.
 * @param	PropertyToLoad		if specified, only the ini value for the specified property will be imported
 */
void ReloadConfig( UClass* ConfigClass=NULL, const TCHAR* Filename=NULL, uint32 PropagationFlags=UE4::LCPF_None, class UProperty* PropertyToLoad=NULL );

/** Import an object from a file. */
void ParseParms( const TCHAR* Parms );

生如夏花之绚烂,死如秋叶之静美。----泰戈尔《生如夏花》