Problems loading a saved gameObject

Discussion and help for Easy Save 3

Problems loading a saved gameObject

Postby AnnasEden » Tue Sep 17, 2019 5:41 pm

Hello Folks! I hope this is the right Thread to ask for help on an error that i aparrently don't understand!

In my Scene I have an inventory that contains gameObjects that are loaded from a prefab. I wanted to save the whole gameObject with all its components and children, ticked the "save Gameobject children" box and at first glance it seemd to work...
When I want to load the game object however, I get this error

Code: Select all
InvalidCastException: Specified cast is not valid.
ES3Types.ES3Type_RectTransform.ReadComponent[T] (ES3Reader reader, System.Object obj) (at Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_RectTransform.cs:36)
ES3Types.ES3ComponentType.ReadUnityObject[T] (ES3Reader reader, System.Object obj) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3ComponentType.cs:36)
ES3Types.ES3UnityObjectType.ReadObject[T] (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3UnityObjectType.cs:79)
ES3Types.ES3ObjectType.Read[T] (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3ObjectType.cs:41)
ES3Types.ES3ObjectType.Read[T] (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3ObjectType.cs:35)
ES3Reader.ReadObject[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:215)
ES3Reader.Read[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:244)
ES3Types.ES3ArrayType.Read (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/Collection Types/ES3ArrayType.cs:58)
ES3Reader.Read[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:240)
ES3Reader.Read[T] () (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:98)
ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader, System.Object obj) (at Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_GameObject.cs:161)
ES3Types.ES3ObjectType.ReadInto[T] (ES3Reader reader, System.Object obj) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3ObjectType.cs:64)
ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_GameObject.cs:128)
ES3Types.ES3ObjectType.Read[T] (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3ObjectType.cs:41)
ES3Reader.ReadObject[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:215)
ES3Reader.Read[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:244)
ES3Types.ES3ArrayType.Read (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/Collection Types/ES3ArrayType.cs:58)
ES3Reader.Read[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:240)
ES3Reader.Read[T] () (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:98)
ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader, System.Object obj) (at Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_GameObject.cs:158)
ES3Types.ES3ObjectType.ReadInto[T] (ES3Reader reader, System.Object obj) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3ObjectType.cs:64)
ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_GameObject.cs:128)
ES3Types.ES3ObjectType.Read[T] (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3ObjectType.cs:41)
ES3Reader.ReadObject[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:215)
ES3Reader.Read[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:244)
ES3Types.ES3ArrayType.Read (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/Collection Types/ES3ArrayType.cs:58)
ES3Reader.Read[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:240)
ES3Reader.Read[T] () (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:98)
ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader, System.Object obj) (at Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_GameObject.cs:158)
ES3Types.ES3ObjectType.ReadInto[T] (ES3Reader reader, System.Object obj) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3ObjectType.cs:64)
ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/Unity Types/ES3Type_GameObject.cs:128)
ES3Types.ES3ObjectType.Read[T] (ES3Reader reader) (at Assets/Plugins/Easy Save 3/Scripts/Types/ES3ObjectType.cs:41)
ES3Reader.ReadObject[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:215)
ES3Reader.Read[T] (ES3Types.ES3Type type) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:244)
ES3Reader.Read[T] (System.String key) (at Assets/Plugins/Easy Save 3/Scripts/Readers/ES3Reader.cs:162)
ES3.Load[T] (System.String key, ES3Settings settings) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:269)
ES3.Load[T] (System.String key) (at Assets/Plugins/Easy Save 3/Scripts/ES3.cs:240)
SaveSystem.Start () (at Assets/Scripts/SaveSystem/SaveSystem.cs:44)


I see that It has some trouble with a recttransform component which is on the gameobject but I thought saving the game object would save all component...?

This is my code
Code: Select all
public void start()
{
  if(ES3.KeyExists("Inventory"))
        {
              ES3.LoadInto<GameObject>("Inventory", InventorySystem.Instance.inventoryCollector);
        }
}

private void OnApplicationQuit()
{
 ES3.Save<GameObject>("Inventory", InventorySystem.Instance.inventoryCollector);
}


The GameObject is on a UI Canvas with a Rect transform, canvas renderer, Image, Grid layout Group and an Event Trigger on it. Its not even about this object but about ist children! The childrne are instanciated on run time whenever I pick up something and my idea was to save this gameobject with its children components and then instanciate the children on start again! But... I cant even load the original game object, not even in a Debug function and I see that it has to do something with thre rectTransform or better say the components on it but why is that a problem and how can I solve it?

Thanks in advance, Anna
AnnasEden
 
Posts: 2
Joined: Tue Sep 17, 2019 5:15 pm

Re: Problems loading a saved gameObject

Postby Joel » Wed Sep 18, 2019 7:17 pm

Hi Anna,

We had an identical error to this in a previous version which was fixed. If you've not done so, first please try updating to see if that fixes your issue.

If this doesn't fix your issue, please could you PM me your invoice number so I can ensure you're being sent the right version from the Asset Store?

All the best,
Joel
Joel Tebbett @ Moodkie Interactive
Twitter - Unity - LinkedIn
User avatar
Joel
Moodkie Staff
 
Posts: 2477
Joined: Wed Nov 07, 2012 10:32 pm

Re: Problems loading a saved gameObject

Postby kylecrafty » Thu Sep 26, 2019 4:31 pm

I'm having this exact issue. Just bought the asset today. Otherwise been having a great time with it.

when I go to the asset store it says I have the following version:
Version: 3.1.4f1 • Aug 12, 2019

is this the fixed version?
kylecrafty
 
Posts: 1
Joined: Thu Sep 26, 2019 4:06 pm

Re: Problems loading a saved gameObject

Postby Joel » Fri Sep 27, 2019 8:29 am

Hi there,

This indeed should be fixed in this version. Please could you PM me a basic project which replicates this?

All the best,
Joel
Joel Tebbett @ Moodkie Interactive
Twitter - Unity - LinkedIn
User avatar
Joel
Moodkie Staff
 
Posts: 2477
Joined: Wed Nov 07, 2012 10:32 pm

Re: Problems loading a saved gameObject

Postby AnnasEden » Wed Oct 02, 2019 6:10 pm

Sorry for replying that late!
My current Version is 3.1.4f1 too. I haven't replied earlier because I thought I found a better approach to what I want to do but I apparently haven't!
AnnasEden
 
Posts: 2
Joined: Tue Sep 17, 2019 5:15 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests