Undelete and now my code cant find Instance?
by Matthew Hoesterey · in Torque X 2D · 09/19/2008 (8:02 pm) · 1 replies
This might just be something basic but I'm at my wits end.
So I accidentally deleted an object in TXB. I hit ctrl z no harm done. Then saved my scene and built my game to test it.
My code started asserting about a null reference
turns out this line:
private T2DSceneObject _player1 = TorqueObjectDatabase.Instance.FindObject("PlayerCore1");
is coming up null.
it can no longer find "PlayerCore1"
I checked torque x builder and sure enough one of my objects has PlayerCore1 written in the scripting name box as it did before.
No problem I think and I delete the object and recreate it. No luck.
So I changed the code to point to an object that is already in my scene and it works.
Thing is if I add an object and give it a scripting reference the code can't find it. It will only find objects that were already in my scene and as such I can't add any new objects to my scene. It's still really early in my projects development so I could recreate my scene but I don't want this to happen in the future when I can't.
I've tried restarting thinking it was a cashing issue but I can't get my code to find new object anymore.
Any thoughts?
So I accidentally deleted an object in TXB. I hit ctrl z no harm done. Then saved my scene and built my game to test it.
My code started asserting about a null reference
turns out this line:
private T2DSceneObject _player1 = TorqueObjectDatabase.Instance.FindObject
is coming up null.
it can no longer find "PlayerCore1"
I checked torque x builder and sure enough one of my objects has PlayerCore1 written in the scripting name box as it did before.
No problem I think and I delete the object and recreate it. No luck.
So I changed the code to point to an object that is already in my scene and it works.
Thing is if I add an object and give it a scripting reference the code can't find it. It will only find objects that were already in my scene and as such I can't add any new objects to my scene. It's still really early in my projects development so I could recreate my scene but I don't want this to happen in the future when I can't.
I've tried restarting thinking it was a cashing issue but I can't get my code to find new object anymore.
Any thoughts?
Torque Owner Matthew Hoesterey
I backed up my code and level files however as I'd like to figure this out as later in my project recreating my level will not be an option. It seams that there is no problem in my C# code and there must be some kind of linkage problem (possibly in the xml?) I haven't been able to find any issues with the xml either though and I'm guessing it's got to be some newb mistake.
Thanks for any help I'd really like to figure out what caused this problem so I don't run into the same thing in the future.