Encountered invalid entry while reading serialization data for Unity object of type 'SoundGameManager'.

Issue #444 resolved
tlearsakura
created an issue

Unity 2018.3

Data dump:

Reader type: SerializationNodeDataReader
Nodes dump:

- Name: 
  Entry: Invalid
  Data: 
- Name: 
  Entry: Invalid
  Data:

Comments (5)

  1. Tor Esa Vestergaard

    Please provide us with as much as possible of the following information:

    1. What happened?
    2. How can we reproduce it?
    3. If screenshots would help explain or demonstrate your issue, please include these.
    4. What version of Unity are you using?
    5. What version of Odin are you using? (See "Tools > Odin Inspector > About")
    6. Do you have Editor Only mode enabled?
    7. What operating system are you on?

    When attaching ZIP files then please remember to remove Odin from the archive.

  2. tlearsakura reporter

    I use Unity 2018.3

    this is problem script

    using EazyTools.SoundManager;
    using Sirenix.OdinInspector;
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public class SoundGameManager : SerializedMonoBehaviour {
    
        public static SoundGameManager ins;
    
        public Dictionary<string, AudioData> bgm;
        public Dictionary<string, AudioData> sfx;
    
        private void Awake() {
            ins = this;
        }
    
        public void PlayBGM(string soundName) {
            AudioData audioData = bgm[soundName];
            if (audioData.audio != null && audioData.audio.paused) {
                print("resume BGM");
                audioData.audio.Resume();
            } else {
                int audioID = SoundManager.PlayMusic(audioData.audioClip, audioData.volume, true, false);
                bgm[soundName].audio = SoundManager.GetAudio(audioID);
            }
        }
    
        public void PlaySFX(string soundName) {
            AudioData audioData = sfx[soundName];
            SoundManager.PlaySound(audioData.audioClip, audioData.volume);
        }
    
        public void PauseBGM(string soundName) {
            AudioData audioData = bgm[soundName];
            if (audioData.audio != null && audioData.audio.playing)
                audioData.audio.Pause();
        }
    
    }
    
    [System.Serializable]
    public class AudioData {
        [HideInInspector]
        public Audio audio;
        public AudioClip audioClip;
        [Range(0f, 1f)]
        public float volume = 1;
    }
    

    It cannot serialize AudioData class.

  3. Tor Esa Vestergaard

    I recently came back to this, and have been unable to replicate the issue. Since no clear reproduction steps were given, and the code sample doesn't in fact compile when copy pasted into a project, I'm not sure what else I can do about this. The modifications I had to make to the code to get it to compile might have made a difference. If you ever get more information about the issue, or figure out the proper reproduction steps to give us, please don't hesitate to reopen the issue at that time :)

  4. Log in to comment