While trying to save to a file a list of objects, needed to run my game, I noticed that Texture2D is not serializable. Why? What was the purpose?
The object I want to serialize:
[Serializable] public class GameObject { private Vector2 position_ = Vector2.Zero; private float rotation_ = 0.0f; private Vector2 scale_ = Vector2.One; private float depth_ = 0.0f; private Texture2D texture_; private bool is_passable_ = true; private GameObject( Vector2 starting_position, string filepath, ContentManager content) { this.position_ = starting_position; this.texture_ = Content.Load<Texture2D>(filepath); } //Properties //Update/Draw } So, the second question: while saving/loading in a game or in a level editor, both composed of a lot of this "GameObject" and derivates, what is correct to serialize? It seems that Texture2D isn't made to be serialized.