Jump to content

Mscr:Assets.Asset

From Ironworks Games Wiki
Revision as of 07:13, 27 August 2026 by Nlondon (talk | contribs)
todo: TO BE COMPLETED

Public Methods

Init

virtual void Init()

Called during initialization of the Asset, either when created or when loaded from disk. Note that this is called after static initialization, but before Assets are loaded. It's recommended to call anything in here that relies on the contents of static variables, see #Static Initialization.

todo: Init is not currently implemented

Static Initialization

Static initialization of Assets is an important topic to understand. Due to the fact that Assets.GetAsset can be called during static initialization, Assets loaded from disk are loaded before the general script static initialization. For that reason, it's important to not rely on any script-defined statics to be available during static initialization and construction of any Asset-derived classes, as all static values will be zero.

If you really need to initialize something using a static, it's recommended to put it in the Init() method.

todo: Defer all actual Asset data loads until after creation, and call Asset.Init() before loading in the data.