Class: Component
Lua
C++
Edit

Component::Save

This method is called when a component is saved to a file or copied.

Syntax

Parameter Description
properties component data in a table object

Returns

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

Remarks

This method can be overridden to add your own custom handling. For example, your component might need to save some extra information or write to another file. 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 Save(table& properties)
{
  properties["health"] = this->health;
  if (this->texture) properties["texture"] = this->texture->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.