Skip to content

Refactor in Prefab system #106

@ncannasse

Description

@ncannasse

Currently the prefab system is a bit hard to work with because of the factory model:

  • some prefabs does have a member variable referencing their scene object, so they won't work in multiple references
  • it is difficult to deal with the Context API, because you can't store all per-instances variables you might want
  • serialization of fields is done by hand (load/save)
  • modifying prefab data at runtime lead to this data being modified for later instances

I propose we change the following:

  • each prefab have serialization through macros (@:s) + custom save/load if needed
  • when doing make, we clone() the prefab then makeInstance the clone, so we keep the original "factory" prefab untouched but the instantiated one will hold a reference to the scene object (it be its own Context).
  • remove Context (or actually ContextShared become Context)

Ping @trethaller @D0pu for comments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions