How to save resources created in the inspector?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Darenn Keller

Hi!

TLDR: When I save resources created in the inspector, it does not always save them and I need to reload the editor.

I’ve created a very simple dialog system for my game. I have “Dialog Timelines” that contains an array of “Dialog Events” that can themselves contain “Dialog Events”. They are all resources.

Here is an example of a timeline : Imgur: The magic of the Internet

As you can see, I only have on .tres file for the timeline and every other resources is created directly in the inspector (so local to the resource if I’m right).

I have problems saving this. For example for the “choices” you can see in the second Dialog Event, it really was a pain.

I create the dialog event in the inspector, fill it in and ctrl-s to save. Then I run the game and the resource is “nil”! Then I restart the project, and the resource I just created disappeared!

So I do it again, and this time when ctrl-s to save, I notice the whole inspector collapse. And this time it works.

I try to create another resource, and I get the same problem again.

It seems like I need to restart the Editor each time I want to add a new resource inside. The whole inspector collapse each time it is saving properly. I tried creating the resources in the project and reference them in my timeline to see if there is any difference, but it’s doing the same thing.

What am I doing wrong? How am I supposed to save resources inside resources?

Thank you by advance for your help.

I would guess it is something you are doing wrong in your save code, are you saving the data to a .dat or a json file? If you could include your saving code that may help to diagnose the issue.

Gluon | 2023-01-31 23:19

Thanks for the reply!

Sorry if I did not explain the problem very well.
I’m not saving the resource with my own code, I’m just trying to save it in the editor avec ctrl-s after creating it.

Darenn Keller | 2023-02-01 07:24