1
TNet 3 Support / Trying to save and load DataNodes to Assets/Resources/
« on: August 02, 2016, 09:45:07 AM »
Hey, I'm trying to save some information from an Editor-script to a Resources folder and then load it back in at runtime, but I'm getting the following error:
What I'm doing to save it in the Editorscript is this:
and then I try to load it at runtime like this:
Why isn't this working? What am I doing wrong? The content of the DataNode is just some ints, Vector3s and strings, nothing special
- Unknown prefix: 85 at position 1
- UnityEngine.Debug:LogError(Object)
- TNet.Tools:LogError(String, String, Boolean) (at Assets/TNet/Common/TNTools.cs:1001)
- TNet.Serialization:ReadObject(BinaryReader, Object, Int32, Type, Boolean) (at Assets/TNet/Common/TNSerializer.cs:2724)
- TNet.Serialization:ReadObject(BinaryReader) (at Assets/TNet/Common/TNSerializer.cs:2360)
- TNet.Serialization:ReadObject(BinaryReader) (at Assets/TNet/Common/TNSerializer.cs:2351)
- TNet.DataNode:Read(Byte[], SaveType) (at Assets/TNet/Common/DataNode.cs:585)
- TNet.DataNode:Read(Byte[]) (at Assets/TNet/Common/DataNode.cs:540)
- TNet.DataNode:Read(String, Boolean) (at Assets/TNet/Common/DataNode.cs:509)
What I'm doing to save it in the Editorscript is this:
- vNode.Write( Application.dataPath + "/_INFO/Resources/" + UnityEngine.SceneManagement.SceneManager.GetActiveScene().name + ".txt", TNet.DataNode.SaveType.Text );
and then I try to load it at runtime like this:
- if( !System.IO.File.Exists( Application.dataPath + "/_INFO/Resources/" + v.vesselUID + ".txt" ) ) return false;
- vesselNode = DataNode.Read( Application.dataPath + "/_INFO/Resources/" + v.vesselUID + ".txt" );
Why isn't this working? What am I doing wrong? The content of the DataNode is just some ints, Vector3s and strings, nothing special