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

Issue #444 new
tlearsakura
created an issue

Unity 2018.3

Data dump:

Reader type: SerializationNodeDataReader
Nodes dump:

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

Comments (3)

  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. Log in to comment