Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: .M.M. on Sun 02/11/2008 11:39:19

Title: Error "Object reference not set to an instance of an object"[SOLVED]
Post by: .M.M. on Sun 02/11/2008 11:39:19
Quote
---------------------------
Adventure Game Studio
---------------------------
An error occurred whilst trying to load your game. The error was:



Object reference not set to an instance of an object.



If you cannot resolve the error, please post on the AGS Technical Forum for assistance.



Error details: System.NullReferenceException: Object reference not set to an instance of an object.

   at ConvertBlockToBitmap32(BITMAP* todraw, Int32 width, Int32 height, Boolean useAlphaChannel)

   at AGS.Native.NativeMethods.GetBitmapForSprite(Int32 spriteSlot, Int32 width, Int32 height)

   at AGS.Editor.NativeProxy.GetBitmapForSprite(Int32 spriteSlot, Int32 width, Int32 height)

   at AGS.Editor.Utilities.GetBitmapForSpriteResizedKeepingAspectRatio(Sprite sprite, Int32 width, Int32 height, Boolean centreInNewCanvas, Boolean drawOutline, Color backgroundColour)

   at AGS.Editor.SpriteSelector.DisplaySpritesForFolder(SpriteFolder folder)

   at AGS.Editor.SpriteSelector.SetDataSource(SpriteFolder rootFolder)

   at AGS.Editor.SpriteManager.GameChanged()

   at AGS.Editor.Components.SpriteManagerComponent.RefreshDataFromGame()

   at AGS.Editor.ComponentController.NotifyDataRefreshNeeded()

   at AGS.Editor.ApplicationController._events_RefreshAllComponentsFromGame()

   at AGS.Editor.EditorEvents.OnRefreshAllComponentsFromGame()

   at AGS.Editor.AGSEditor.RefreshEditorAfterGameLoad(Game newGame)

   at AGS.Editor.Tasks.LoadGameFromDisk(String gameToLoad, Boolean interactive)

   at AGS.Editor.InteractiveTasks.LoadGameFromDisk(String gameToLoad)
---------------------------
OK   
---------------------------
Do you know what does it mean? I just added normal sprite into my game (game:320x200 32bit, sprite:60x25) and used it for new inventory item. I am using AGS 3.0.2 SP1.
Title: Re: Error "Object reference not set to an instance of an object"
Post by: RickJ on Sun 02/11/2008 15:06:29
I don't know why you are getting those errors but for gods sake make a backup copy of your entire game folder before you do anything else!!!  I know it's pointless to ask but when was the last time you made a backup of your game?  Ok, assuming that you don't have a recent backup then there are a couple of other things you can try.

o Copy the file backup_acsprset.spr to acsprset.spr
o Copy the file Game.agf.bak to Game.agf
o Try staring editor now ..

Someone else may have more insight into what's causing your problem.
Title: Re: Error "Object reference not set to an instance of an object"
Post by: Pumaman on Sun 02/11/2008 15:06:58
Does this happen every time you try to load the game? Would you be able to upload the game folder for me to investigate?
Title: Re: Error "Object reference not set to an instance of an object"
Post by: .M.M. on Mon 03/11/2008 15:28:41
Quote from: RickJ on Sun 02/11/2008 15:06:29
I know it's pointless to ask but when was the last time you made a backup of your game?
I made backup copy in 23rd October.
Quote from: Pumaman on Sun 02/11/2008 15:06:58
Does this happen every time you try to load the game? Would you be able to upload the game folder for me to investigate?
Yes, it happens every every time. Here is the download link. (http://data.uloz.cz/auth/4f89df815b5052880f9b2a079ffe3960/file/85894-PRPG_SpriteError_2.11.zip)
Title: Re: Error "Object reference not set to an instance of an object"
Post by: Khris on Mon 03/11/2008 15:49:40
You didn't rename "backup_acsprset.spr" to "acsprset.spr".

Do that and your game will load fine (tested using 3.1 Final).
Title: Re: Error "Object reference not set to an instance of an object"
Post by: .M.M. on Mon 03/11/2008 16:54:20
Yes, you´re right, but I did not move any files! Before this error occured, window with sprite preview at every inventory item disappeared and now, after renaming the file, newest sprite has been replaced with 60x25 resized blue cup... It looks like engine saved the sprite badly, because I added the sprite again with no problems.
Title: Re: Error "Object reference not set to an instance of an object"
Post by: Pumaman on Mon 03/11/2008 20:33:13
Hmm, your download link doesn't work for me -- it just gives me a page saying "8e4550d2b2d9b0004037821b0f923d74"?

Even if you've got it working again I'd still like to be able to download and investigate the version with the error, in case there's anything that needs to be fixed.
Title: Re: Error "Object reference not set to an instance of an object"
Post by: .M.M. on Wed 05/11/2008 17:11:47
Oh, yes, I am really sorry. This one (http://www.uloz.cz/show/file/85894-PRPG_SpriteError_2.11.zip) works. Just click on PRPG_SpriteError_2.11.zip.
Title: Re: Error "Object reference not set to an instance of an object"
Post by: Pumaman on Wed 05/11/2008 20:02:17
Hmm, that's strange ... looks like the ACSPRSET.SPR file is missing for some reason.

You didn't have any errors/crashes/power failures whilst saving the game? You didn't run out of disk space or anything like that?

This is quite puzzling.
Title: Re: Error "Object reference not set to an instance of an object"
Post by: .M.M. on Thu 06/11/2008 16:35:12
Quote from: Pumaman on Wed 05/11/2008 20:02:17
You didn't have any errors/crashes/power failures whilst saving the game? You didn't run out of disk space or anything like that?
No... At least I do not know about it.  :P
And I have 19,4 GB of free space...
Title: Re: Error "Object reference not set to an instance of an object"
Post by: Ryan Timothy B on Sun 09/11/2008 17:53:18
Not sure what I'm doing wrong here.  I remember there being a limit to the vertical height of scrolling backgrounds, but I can't seem to find what it is.

I am trying to change the background to a large 1920x1440 and each time I try to import it, I get the "Object reference not set to an instance of an object".

I'm curious what this means and why it won't let me import the background.

BTW, using 3.01
Title: Re: Error "Object reference not set to an instance of an object"
Post by: Pumaman on Sun 09/11/2008 18:25:09
Can you post the full error message, like Mirek did in his first post. It likely won't be an identical error since you're talking about a background and he's talking about a sprite.
Title: Re: Error "Object reference not set to an instance of an object"
Post by: Ryan Timothy B on Sun 09/11/2008 18:32:18
Yeah, that was the only error it initially gave me.

Then I JUST imported a 640x480 background to see if it would allow even that and it worked.  Then I tried to import the large background and thats where it gave me the large error screen, just as I copied it, my computer went on the fritz (no idea why, I think ags went wacky because of it) so I just manually reset my computer.  So I lost the clipboard copy.

I'm going to try to recreate the error message.

EDIT: Well that's weird.  I tried adding a few rooms with the same background and nothing bad happened.  So I created a new game to see if I could recreate it by doing the same things I did in the last game.  And there are zero problems what-so-ever.  A temporary AGS gremlin I presume? lol