BakingSheet icon indicating copy to clipboard operation
BakingSheet copied to clipboard

unity version 2022.3.11f1 Crash when import example of HeroSheet.cs

Open hoangcuongzk1 opened this issue 2 years ago • 4 comments

hoangcuongzk1 avatar Nov 11 '23 09:11 hoangcuongzk1

Hello. I import package, and copy paste the code of https://github.com/cathei/BakingSheet/blob/master/UnityProject/Assets/Samples/001%20-%20Define%20Sheet%20Container/HeroSheet.cs.

And when i clone from gg sheet, Unity being Crash, Another DataType is still good. But HeroSheet does not work. Note:

  • Of cource at GG sheet side, my csv is copied by the same example.
  • i not yet test on another Unity version.

hoangcuongzk1 avatar Nov 11 '23 09:11 hoangcuongzk1

Thanks for reporting. I couldn't reproduce this locally. If you can please share the reproducible project so I can look into it.

cathei avatar Nov 12 '23 22:11 cathei

i tested again on unity 2022.3.8 and still being Crash. Here is my c# code

 public class HeroSheet : Sheet<HeroSheet.Row>
    {
        public class Row : SheetRowArray<Elem>
        {
            public string Name { get; private set; }

            public int Strength { get; private set; }
            public int Inteligence { get; private set; }
            public int Vitality { get; private set; }

            public Elem GetLevel(int level)
            {
                // Level 1 would be index 0
                return this[level - 1];
            }

            // Max level would be count of elements
            public int MaxLevel => Count;
        }

        public class Elem : SheetRowElem
        {
            public float StatMultiplier { get; private set; }
            public int RequiredExp { get; private set; }
            public string RequiredMaterial { get; private set; }
        }
    }
    
    public class TestSheetRuntime:  SheetContainerBase
    {
      public TestSheetRuntime(Microsoft.Extensions.Logging.ILogger logger) : base(logger) {}
      public HeroSheet HeroSheet { get; private set; }
    }
    
       public class TestGGSheetUI : MonoBehaviour
    {
        [SerializeField] private TextMeshProUGUI logTxt;
        [SerializeField] private string sheetId;
        [SerializeField] private TextAsset credential;

        [Button]
        async void Pull()
        {
            TestSheetRuntime test = new( new UnityLogger());
            var googleConverter = new GoogleSheetConverter(sheetId, credential.text);
            await test.Bake(googleConverter);

            logTxt.text = test.HeroSheet[0].Name;
        }
    }

image

hoangcuongzk1 avatar Nov 14 '23 07:11 hoangcuongzk1

Bit late to reply, but your sheet appear ill-formed, as numbers (that should be in StatMultiplier) are invading Id column, and so on. I've tested with the given sample but it doesn't seem to cause crash. Let me know if you have different concerns or more info. Thank you!

cathei avatar Jun 18 '24 03:06 cathei