FigmaToUnityImporter icon indicating copy to clipboard operation
FigmaToUnityImporter copied to clipboard

An error that I accidentally found in the last topiс - NullReferenceException: Object reference not set to an instance of an object FigmaImporter.Editor.FigmaNodeGenerator.AddFills

Open VladislavMm opened this issue 2 years ago • 7 comments

NullReferenceException: Object reference not set to an instance of an object FigmaImporter.Editor.FigmaNodeGenerator.AddFills (FigmaImporter.Editor.Node node, UnityEngine.GameObject nodeGo) (at Assets/Plugins/FI/Editor/FigmaNodeGenerator.cs:147) image They don't catch me like that because of this - image The project is very large and complex, before that they still get this warning- Serialization depth limit 10 exceeded at 'FigmaImporter.Editor::Node.children'. There may be an object composition cycle in one or more of your serialized classes.

Serialization hierarchy: 11: FigmaImporter.Editor::Node.children 10: FigmaImporter.Editor::Node.children 9: FigmaImporter.Editor::Node.children 8: FigmaImporter.Editor::Node.children 7: FigmaImporter.Editor::Node.children 6: FigmaImporter.Editor::Node.children 5: FigmaImporter.Editor::Node.children 4: FigmaImporter.Editor::Node.children 3: FigmaImporter.Editor::Node.children 2: FigmaImporter.Editor::Node.children 1: FigmaImporter.Editor::Node.children 0: FigmaImporter.Editor::Node.children

This is an error message related to object serialization in Unity. The error occurs when the serialization depth limit of 10 levels is reached, and objects continue to refer to each other in a loop. This can happen if one object references another, and the second refers back to the first, creating an infinite loop. To solve this error, it is necessary to review the structure of objects and make sure that there are no cyclic references.

You can also try using another serialization method, for example, JSON or XML, instead of standard serialization in Unity. This can help avoid problems with serialization depth and circular references.

I don't think that if (node.field != null) probably a good solution, although it works well, it's good for me, maybe it won't be suitable for other people) wrote it here that it is possible to solve it well and in the future someone will not encounter it

VladislavMm avatar May 13 '23 16:05 VladislavMm

As an option - image image

VladislavMm avatar May 14 '23 06:05 VladislavMm

@VladislavMm Looks like the problem is in tree view. I will think how to limit it. I will also check the solution that you proposed. But a bit later. Thank you for your help 👍

ManakhovN avatar May 15 '23 06:05 ManakhovN

@ManakhovN @VladislavMm have you found a solution to this issue? or can explain how to solve it? i am experiencing it also. this is the first plugin that at least imports the document into unity. but the last step of generating the content on the UI is not yet working for me.

shacharoz avatar Jun 19 '24 09:06 shacharoz

i have found something. there is an issue with some of the sample images that are being created inside figma.

second issue was to arrange the ui in different pages, rather than as several layouts in one page

shacharoz avatar Jun 19 '24 09:06 shacharoz

if user uses this url: https://www.figma.com/design/project_hex_code/project_name?node-id=2-522 things will be ok. the frame content is the one being imported correctly!

you can close the ticket

shacharoz avatar Jun 19 '24 12:06 shacharoz

@shacharoz Hello, thanks for your messages. So with the proper URL it works as intended? Or how did you fix it?

ManakhovN avatar Jun 19 '24 16:06 ManakhovN

@ManakhovN at the end i saw that in your documentation it is actually say to take the link from the Frame. so I guess you are fine. close this ticket.

shacharoz avatar Jun 19 '24 18:06 shacharoz