Can't "Build and Run" on Android platform 'cause serialization 'Region' reason.

Issue #543 new
Ivan Murzak created an issue

I just press “Build and Run” button and get error message in console. There is a link to the Bitbucket and suggestion to upload logs and create bug report.

  1. Can’t “Build and Run” on Android. There is the error in logs
  2. Maybe you should have my project for reproduce it. But I just select Android platform and press “Build and Run”. It works fine if I press just “Build”
  3. Useless in the case
  4. Unity: 2019.1.3
  5. ODIN: 2.0.16
  6. No
  7. Windows 10 x64 (but target platform is Android)

SerializationAbortException: The following error was logged during serialization or deserialization: Encountered invalid entry while reading serialization data for Unity object of type 'Region'. Please report this issue at 'https://bitbucket.org/sirenix/odin-inspector/issues', and copy paste this debug message into the issue report, along with any potential actions or recent changes in the project that might have happened to cause this message to occur. If the data dump in this message is cut off, please find the editor's log file (see https://docs.unity3d.com/Manual/LogFiles.html) and copy paste the full version of this message from there.


Data dump:

    Reader type: SerializationNodeDataReader
    Data dump: Nodes: 

    - Name:     <<<< READ POSITION

      Entry: 0

      Data: 

    - Name: 

      Entry: 0

      Data: 

    - Name: 

      Entry: 0

      Data: 

    - Name: 

      Entry: 0

      Data: 

    - Name: 

      Entry: 0

      Data: 


Sirenix.Serialization.DebugContext.LogError (System.String message) (at X:/Repositories/sirenix-development-framework/OdinSerializer/OdinSerializer/Core/Misc/SerializationConfig.cs:203)
Sirenix.Serialization.UnitySerializationUtility.DeserializeUnityObject (UnityEngine.Object unityObject, Sirenix.Serialization.IDataReader reader) (at X:/Repositories/sirenix-development-framework/OdinSerializer/OdinSerializer/Unity Integration/UnitySerializationUtility.cs:1610)
Rethrow as SerializationAbortException: Deserialization of type 'Region' aborted.
Sirenix.Serialization.UnitySerializationUtility.DeserializeUnityObject (UnityEngine.Object unityObject, Sirenix.Serialization.IDataReader reader) (at X:/Repositories/sirenix-development-framework/OdinSerializer/OdinSerializer/Unity Integration/UnitySerializationUtility.cs:1656)
Sirenix.Serialization.UnitySerializationUtility.DeserializeUnityObject (UnityEngine.Object unityObject, Sirenix.Serialization.SerializationData& data, Sirenix.Serialization.DeserializationContext context, System.Boolean isPrefabData, System.Collections.Generic.List`1[T] prefabInstanceUnityObjects) (at X:/Repositories/sirenix-development-framework/OdinSerializer/OdinSerializer/Unity Integration/UnitySerializationUtility.cs:1427)
Sirenix.Serialization.UnitySerializationUtility.DeserializeUnityObject (UnityEngine.Object unityObject, Sirenix.Serialization.SerializationData& data, Sirenix.Serialization.DeserializationContext context) (at X:/Repositories/sirenix-development-framework/OdinSerializer/OdinSerializer/Unity Integration/UnitySerializationUtility.cs:1147)
Sirenix.OdinInspector.SerializedMonoBehaviour.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () (at X:/Repositories/sirenix-development-framework/OdinSerializer/OdinSerializer/Unity Integration/SerializedUnityObjects/SerializedMonoBehaviour.cs:37)
UnityEditor.SceneManagement.EditorSceneManager:OpenScene(String, OpenSceneMode)
Sirenix.Serialization.Editor.AOTSupportScanner:ScanScenes(String[], Boolean, Boolean) (at X:/Repositories/sirenix-development-framework/OdinSerializer/OdinSerializer/Unity Integration/AOTSupportScanner.cs:225)
Sirenix.Serialization.Editor.AOTSupportScanner:ScanBuildScenes(Boolean, Boolean) (at X:/Repositories/sirenix-development-framework/OdinSerializer/OdinSerializer/Unity Integration/AOTSupportScanner.cs:183)
Sirenix.Serialization.Editor.AOTSupportUtilities:ScanProjectForSerializedTypes(List`1&) (at X:/Repositories/sirenix-development-framework/OdinSerializer/OdinSerializer/Unity Integration/AOTSupportUtilities.cs:48)
Sirenix.Serialization.AOTGenerationConfig:ScanProject() (at X:/Repositories/sirenix-development-framework/Sirenix Solution/Sirenix.OdinInspector.Editor/Drawers/Attribute Drawers/AssetListAttributeDrawer.cs:255)
Sirenix.Serialization.Internal.PreBuildAOTAutomation:OnPreprocessBuild(BuildTarget, String) (at Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/BuildAOTAutomation.cs:43)
Sirenix.Serialization.Internal.PreBuildAOTAutomation:OnPreprocessBuild(BuildReport) (at Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/BuildAOTAutomation.cs:52)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Comments (2)

  1. Ivan Murzak reporter

    There is ‘Region’ source code

    using Sirenix.OdinInspector;
    using System.Collections.Generic;
    using UniRx;
    using System;
    using Zenject;
    using System.Linq;
    using BigInt = System.Numerics.BigInteger;
    
    public class Region : BaseMonoBehaviour, ISaverDataListener<RegionSaver.RegionData>, ISaverDataModifier<RegionSaver.RegionData>, IPreBuildSetup
    {
        public const string CAPITAL = "RegionCapital";
        public const string ON_OWNED_ANY_REGION = "OnOwnedAnyRegion";
    
        [NonSerialized] public static IObservable<Region> onOwnedAny = new Subject<Region>();
        [ReadOnly, NonSerialized] public BoolReactiveProperty owned = new BoolReactiveProperty(false);
    
    #pragma warning disable 0649
        [Required] public ReactiveAcceptButton btnBuy;
        [FoldoutGroup("Price"), HorizontalGroup("Price/1"), Required]
        public UILabel priceNormal, priceAccepted;
        public List<Region> dependecies = new List<Region>();
    
        [Required] public List<Spawner> spawners;
        [Required] public List<TowerSlot> towerSlots;
    
        [Inject] WalletSO wallet;
        [Inject] UIButtonSettings buttonSettings;
        [Inject] IslandDataSO islandData;
    #pragma warning restore 0649
    
        Action<RegionSaver.RegionData> onModified;
    
        public BigInt Price => islandData.regions[name].price;
        public bool Unlocked => dependecies.Any(x => x.owned.Value);
        public RegionSaver.RegionData Data { get; private set; }
    
        IObserver<Region> OnOwnedAnyObserver => onOwnedAny as IObserver<Region>;
    
        public void PreBuildSetup()
        {
            UpdateSpawners();
            UpdateTowerSlots();
            UpdatePrices();
    
    #if UNITY_EDITOR
            if (UnityEditor.PrefabUtility.IsPartOfPrefabInstance(this))
            {
                Sirenix.OdinInspector.Editor.OdinPrefabUtility.UpdatePrefabInstancePropertyModifications(this, false);
            }
    #endif
        }
    
        private void Start()
        {
            UpdatePrices(); // TODO: should execute in prebuild stage
    
            UpdateBuyButton(owned.Value);
    
            owned.SkipLatestValueOnSubscribe().Subscribe(x =>
            {
                Data.owned = x;
                if (onModified != null) onModified.Invoke(Data);
                UpdateBuyButton(x);
    
                if (x) OnOwnedAnyObserver.OnNext(this);
            }).AddTo(this);
    
            btnBuy.onClick.Subscribe(x =>
            {
                if (Price <= wallet.coins.Value)
                {
                    wallet.coins.Value -= Price;
                    owned.Value = true;
                }
            }).AddTo(this);
    
            btnBuy.btnNormal.onClick.Merge(btnBuy.btnAccept.onClick).Subscribe(x =>
            {
                if (Price > wallet.coins.Value) ShakeBuyButton();
                else btnBuy.isAcceptMode.Value = !btnBuy.isAcceptMode.Value;
            }).AddTo(this);
    
            // blink btnBuy when press on slot
            Observable.Merge(towerSlots.Select(x => x.Button.onClickDisabled))
                .Where(x => !owned.Value)
                .Subscribe(x => BlinkBuyButton())
                .AddTo(this);
        }
    
        public void OnLoaded(RegionSaver.RegionData data)
        {
            this.Data = data;
            if (data.owned) btnBuy.gameObject.SetActive(false);
            owned.Value = data.owned;
        }
    
        public void RegisterDataModifiedListener(Action<RegionSaver.RegionData> onModified)
        {
            this.onModified = onModified;
        }
    
        [ButtonGroup("Update"), Button]
        public void UpdateSpawners()
        {
            if (spawners == null) spawners = new List<Spawner>();
            spawners.Clear();
            spawners.AddRange(GetComponentsInChildren<Spawner>());
        }
    
        [ButtonGroup("Update"), Button]
        public void UpdateTowerSlots()
        {
            if (towerSlots == null) towerSlots = new List<TowerSlot>();
            towerSlots.Clear();
            towerSlots.AddRange(GetComponentsInChildren<TowerSlot>());
        }
    
        public void UpdatePrices()
        {
            var formatedPrice = Coins.Format(Price);
            priceNormal.text = formatedPrice;
            priceAccepted.text = formatedPrice;
        }
    
        [HorizontalGroup("Buy Button"), Button]
        void ShakeBuyButton()
        {
            if (btnBuy.isActiveAndEnabled)
                buttonSettings.AnimationError(btnBuy.transform);
        }
    
        [HorizontalGroup("Buy Button"), Button]
        void BlinkBuyButton()
        {
            if (btnBuy.isActiveAndEnabled)
                buttonSettings.AniamtionAttention(btnBuy.transform);
        }
    
        void UpdateBuyButton(bool regionOwned)
        {
            if (regionOwned)    btnBuy.gameObject.SetActive(false);
            else                buttonSettings.FadeIn(btnBuy.transform);
        }
    }
    
  2. Tor Esa Vestergaard

    Try updating Odin to 2.0.20 - there is an improved error message for this case in that version. We are still trying to figure out exactly what is going on with this error. It is a particular Odin-serialized asset or GameObject in your project that is causing this. Reimporting. HOWEVER, before trying to fix it, if you can send me a repro project and point out the asset in question which is bugging, then that could be very helpful in trying to figure out what is going on. And if you ever figure out a way of making this happen consistently, that would be wonderful.

  3. Log in to comment