Hey guys,
I am getting this error, but cannot figure out what I'm doing wrong.
I am fairly new to Javascript, but the plugin I was using as a reference for the saving/loading seems to work fine and mine doesn't despite me being unable to see any fundamental differences.
TypeError: Object prototype may only be an Object or null: undefined {stack: (...), message: "Object prototype may only be an Object or null: undefined"}
//-----------------------------------------------------------------------------
// DATA MANAGER
//-----------------------------------------------------------------------------
var farming_DataManager_createGameObjects = DataManager.createGameObjects;
var farming_DataManager_makeSaveContents = DataManager.makeSaveContents;
var farming_DataManager_extractSaveContents = DataManager.extractSaveContents;
DataManager.createGameObjects = function () {
farming_DataManager_createGameObjects.call(this);
$farming = new Farming();
}
DataManager.makeSaveContents = function () {
var contents = farming_DataManager_makeSaveContents(this);
contents.farming = $farming;
return contents;
}
DataManager.extractSaveContents = function (contents) {
farming_DataManager_extractSaveContents.call(this, contents);
$farming = contents.farming;
var f = new Farming();
$farming.__proto__ = f.__proto__;
}
That code is basically copied from Vlue's GameTime plugin where it works fine. Mine does not however.
Here is my Farming Object:
//-----------------------------------------------------------------------------
// FARMING OBJECT
//-----------------------------------------------------------------------------
function Farming() {
this.initialize.apply(this, arguments);
}
Farming.prototype.initialize = function () {
console.log("Farming Initialized");
}
Just a console log in the initialization.
I feel like I am missing something obvious..
I am getting this error, but cannot figure out what I'm doing wrong.
I am fairly new to Javascript, but the plugin I was using as a reference for the saving/loading seems to work fine and mine doesn't despite me being unable to see any fundamental differences.
TypeError: Object prototype may only be an Object or null: undefined {stack: (...), message: "Object prototype may only be an Object or null: undefined"}
//-----------------------------------------------------------------------------
// DATA MANAGER
//-----------------------------------------------------------------------------
var farming_DataManager_createGameObjects = DataManager.createGameObjects;
var farming_DataManager_makeSaveContents = DataManager.makeSaveContents;
var farming_DataManager_extractSaveContents = DataManager.extractSaveContents;
DataManager.createGameObjects = function () {
farming_DataManager_createGameObjects.call(this);
$farming = new Farming();
}
DataManager.makeSaveContents = function () {
var contents = farming_DataManager_makeSaveContents(this);
contents.farming = $farming;
return contents;
}
DataManager.extractSaveContents = function (contents) {
farming_DataManager_extractSaveContents.call(this, contents);
$farming = contents.farming;
var f = new Farming();
$farming.__proto__ = f.__proto__;
}
That code is basically copied from Vlue's GameTime plugin where it works fine. Mine does not however.
Here is my Farming Object:
//-----------------------------------------------------------------------------
// FARMING OBJECT
//-----------------------------------------------------------------------------
function Farming() {
this.initialize.apply(this, arguments);
}
Farming.prototype.initialize = function () {
console.log("Farming Initialized");
}
Just a console log in the initialization.
I feel like I am missing something obvious..