【混淆】防崩溃
parent
80fabc8f94
commit
7fbd9ad15f
|
|
@ -4,8 +4,10 @@ using cfg.FightCfg;
|
|||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
using Newtonsoft.Json;
|
||||
using Obfuz;
|
||||
|
||||
[Serializable]
|
||||
[ObfuzIgnore]
|
||||
public class MapData
|
||||
{
|
||||
[Serializable]
|
||||
|
|
|
|||
|
|
@ -53,8 +53,19 @@ public static class MapUtils
|
|||
DebugUtil.Log("[MapUtils: LoadMapData] ------------ 4");
|
||||
MapData mapData = null;
|
||||
DebugUtil.Log("[MapUtils: LoadMapData] ------------ 5");
|
||||
if (textAsset is not null)
|
||||
mapData = JsonUtility.FromJson<MapData>(textAsset.text);
|
||||
try
|
||||
{
|
||||
// 这里可能会抛异常,捕获一下避免程序崩溃
|
||||
if (textAsset is not null)
|
||||
{
|
||||
mapData = JsonUtility.FromJson<MapData>(textAsset.text);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugUtil.LogError("LoadMap.LoadMap failed, exception:{0}", e.ToString());
|
||||
}
|
||||
|
||||
DebugUtil.Log("[MapUtils: LoadMapData] ------------ 6");
|
||||
if (null == mapData)
|
||||
DebugUtil.LogError("LoadMap.LoadMap failed, can not find map config: {0}", mapPath);
|
||||
|
|
|
|||
Loading…
Reference in New Issue