29.04.2014, 00:45
No it is not.
What you're doing is saving the Game Object ID into column 0 in the "houses" (I'm assuming) table.
The solution is to instead save a 1-bit number like 0 and 1, 0 will mean the house doesn't have a safe, and 1 will mean it does have a safe.
To detect if the house has a safe or not, when saving make it see if the game object != invalid game object id
- if it does have a safe make it save as 1
- if not save as 0
Then when loading to check if the house has a safe or not, check if the number is 0 if it's not 0 create the safe.
What you're doing is saving the Game Object ID into column 0 in the "houses" (I'm assuming) table.
The solution is to instead save a 1-bit number like 0 and 1, 0 will mean the house doesn't have a safe, and 1 will mean it does have a safe.
To detect if the house has a safe or not, when saving make it see if the game object != invalid game object id
- if it does have a safe make it save as 1
- if not save as 0
Then when loading to check if the house has a safe or not, check if the number is 0 if it's not 0 create the safe.