I recently added the Serialization and Localization packages which seemed to have destroyed every single script graph in the active scene. I checked the scene file itself and can tell that the embedded graph methods are still saved within the scene. Does anyone know how I can force them to reappear in the editor? They also are not running during Play mode. It’s the strangest thing and I’ve found no information that could help me. Restoring from a backup is not possible either because of separate bugs with Microsoft OneDrive. I need to find a way to restore them manually. Any help would be greatly appreciated.
- Start using a version control system like git immediately.
- Try re-import your prefab, if it’s not working you can try to delete and restore your files it should force a re-import of the graph.
- The data are stored as JSON. You can try to open it in another software to check if the file is valid and fix it if you can.
- I know. I thought I was actually, but I never committed any changes because I’m an ignorant noob.
- Not all the objects with missing script graphs are prefabs. The ones that are prefabs are fine, oddly enough. What do you mean delete and restore my files?
- What software do you recommend? I dug around in it in Visual Studio and could tell the graphs still had fileIDs and GUID numbers.
What do you mean by destroyed? Is the graph empty or unreachable?
I though you had problems with prefabs too.
At this point I would try to save the game object of your scene into prefab that contains the graph. To solve the problem individually.
I would also try to convert the graph from embed to macro if you can to see if it’s help
Lastly I would copy the scene file of your project, removed it from the project and paste it at the same place (that what I mean for delete and restore, suppr, ctrl-z should work to) to force the graph deserialization (because I’m not sure reimporting the file enough).
Look at the errors in the console when you do this (you might want to set a debug point at this place to understand what is wrong (with the data I guess).
You can check the JSON in a nice way with the contextual menu Show Data.
The JSON for this graph is:
Test
Object References:
(None)
JSON:
{
"nest": {
"source": "Embed", // Metadata
"macro": null, // Metadata
"embed": { // Contains all the embed graph data
"variables": { // Variables if you have any
"Kind": "Flow",
"collection": {
"$content": [],
"$version": "A"
},
"$version": "A"
},
"controlInputDefinitions": [],
"controlOutputDefinitions": [],
"valueInputDefinitions": [],
"valueOutputDefinitions": [],
"title": "Test", // Metadata
"summary": null, // Metadata
"pan": { // Metadata
"x": 0.0,
"y": 0.0
},
"zoom": 1.0, // Metadata
"elements": [ // units + connections
{ // Units start here
"coroutine": false,
"defaultValues": {
},
"position": {
"x": -204.0,
"y": -144.0
},
"guid": "f0e984c3-b358-4344-ba18-4d626f43f4e0",
"$version": "A",
"$type": "Unity.VisualScripting.Start",
"$id": "10"
},
{
"inputCount": 2,
"defaultValues": {
"1": {
"$content": 2.0,
"$type": "System.Single"
}
},
"position": {
"x": 101.0,
"y": -37.0
},
"guid": "800c461d-49b2-4aad-9881-fa59ce8c1ea7",
"$version": "A",
"$type": "Unity.VisualScripting.ScalarSum",
"$id": "12"
},
{
"type": "System.Single",
"value": {
"$content": 1.0,
"$type": "System.Single"
},
"defaultValues": {
},
"position": {
"x": -58.0,
"y": -35.0
},
"guid": "f0446483-6570-4115-935e-ffbd9cbb0f4f",
"$version": "A",
"$type": "Unity.VisualScripting.Literal",
"$id": "14"
},
{
"chainable": false,
"parameterNames": [
"message"
],
"member": {
"name": "Log",
"parameterTypes": [
"System.Object"
],
"targetType": "UnityEngine.Debug",
"targetTypeName": "UnityEngine.Debug",
"$version": "A"
},
"defaultValues": {
},
"position": {
"x": 289.0,
"y": -144.0
},
"guid": "3d4fcd9d-6b47-4177-bb69-3843431b3207",
"$version": "A",
"$type": "Unity.VisualScripting.InvokeMember",
"$id": "16"
},
{ // Connections start here (search for sourceUnit, destinationUnit)
"sourceUnit": {
"$ref": "10"
},
"sourceKey": "trigger",
"destinationUnit": {
"$ref": "16"
},
"destinationKey": "enter",
"guid": "1b2de36d-aa37-473a-8be2-3ea7755dedbe",
"$type": "Unity.VisualScripting.ControlConnection"
},
{
"sourceUnit": {
"$ref": "14"
},
"sourceKey": "output",
"destinationUnit": {
"$ref": "12"
},
"destinationKey": "0",
"guid": "ed9245cf-ecb8-41db-b4a4-5d485b2f2c66",
"$type": "Unity.VisualScripting.ValueConnection"
},
{
"sourceUnit": {
"$ref": "12"
},
"sourceKey": "sum",
"destinationUnit": {
"$ref": "16"
},
"destinationKey": "%message",
"guid": "75b10696-1991-4b6f-acde-ef7ed083942e",
"$type": "Unity.VisualScripting.ValueConnection"
}
],
"$version": "A"
}
}
}
The JSON file is composed of multiples sections that you need to understand to fix your problem
You can note that the unit and connection between units are stored in the same place (elements)
There is metadata like the title and description that may need to be present for the serialization to be sucessful (just compare your file with a valid json to check any errors).
In a prefab the data saved in the prefab in a single line that you may need to edit to solve your problem.
I just use Visual Studio Code for JSON files. You can just copy the content inside the two single quotation marks and format the document with a right-click to develop the file.
To revert the new line you can just use this option.
Then, I would start by removing all the connection elements. If there is a specific connection that breaks your graph, remove all the units to see if the problem comes from some units. If it does not, revert some elements one at a time, starting with the units, to see if it starts working.
I hope this helps you.
The embedded graphs in the entire scene are no longer there. The objects show script machine components, but none of them have any graphs (embedded or not) set in them. They all look like this now.
The non-embedded ones are fine because I can just relink them, but the ones that were formally embedded are just poof gone. It’s been 3 weeks dealing with this, so I just found a 3-month-old backup and am redoing my updates since then. I have since figured out how to properly use Version Control, fixed my stupid OneDrive, and bought an SSD for a physical back up. I just wish Unity stored Visual Scripting data better. This is the 3rd time either variables or graphs have just disappeared after installing or updating a package. That information should really be stored somewhere better. Thanks for trying to help. I appreciate it a lot.
SOLUTION: I rewrote the entire f$%*ing game in 8 months.