Class: Component
Lua
C++
Edit

Component::Load

This method is called when a component is loaded from a file or copied.

Syntax

Parameter Description
properties component data in a table object

Returns

Returns true if the component is successfully loaded, otherwise false is returned.

Remarks

This method can be overridden to add your own custom handling. For example, your component might need to create extra entities to use. If you do so, you will probably want to call the base method without your method, to load the built-in supported data types, like so:

bool Load(const table& properties)
{
  this->health = properties["health"];
  std::string path = properties["texture"];
  if (not path.empty()) this->texture = LoadTexture(path);
  return true;
}

The Ultra Engine entity component system will automatically save and load the following data types:

Additionally, Entity shared pointers are supported, as long as the entity is stored in the same file.

Copyright © 2024 Ultra Software.
All rights reserved.