Your object will also be set to null when you save your scene, close the scene and open it again.Īll the scripts which inherit from MonoBehaviour are serializable, but your custom classes are not. So, your hiddenObject is set to null whenever unity deserializes your Inventory class, which is when you hit play or stop. And obviously it can't be deserialized either, since it wasn't saved in the first place. So, when you hit play, unity serializes the gameobject in you scene, which has the Inventory script on it, but the hiddenObject member of your Inventory class is not serializable, so it's not saved. The problem in your case is the object that you are creating(HiddenObject) is not serializable. The game was released in February 15, 2019. During this copy process it deserializes the objects with the data it saved just before copying, so no visible change is done on the objects. Unite To FightGame slogan Jump Force, stylized as JUMP Force, is a 3D fighting video game developed by Spike Chunsoft and published by Bandai Namco for the Xbox One, PlayStation 4, and Windows. Unity also creates copies of all objects in the scene, so the changes you do during play mode change the copies, not the original objects in the scene. When you hit the play button in the editor, all the objects in the active scene are serialized and saved, so that unity can deserialize and return them to their original state when you stop the execution in the editor. The solution is simple, but I feel the need to describe what unity does when you hit the play button: This is not a bug, I had the same problems when I was writing my first unity editor code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |