Skip to content

Commit 2f599be

Browse files
committed
fix a bug that sometime duplicate stage cameras
1 parent efcb909 commit 2f599be

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Assets/Scripts/Utils/Html/HtmlPageContext.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using TMPro;
23
using UnityEngine;
34

45
namespace FairyGUI.Utils
@@ -14,15 +15,25 @@ public class HtmlPageContext : IHtmlPageContext
1415
Stack<IHtmlObject> _selectPool;
1516
Stack<IHtmlObject> _linkPool;
1617

17-
public static HtmlPageContext inst = new HtmlPageContext();
18+
static HtmlPageContext _inst;
19+
20+
public static HtmlPageContext inst
21+
{
22+
get
23+
{
24+
if (_inst == null)
25+
_inst = new HtmlPageContext();
26+
return _inst;
27+
}
28+
}
1829

1930
static Transform _poolManager;
2031

2132
#if UNITY_2019_3_OR_NEWER
2233
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
2334
static void InitializeOnLoad()
2435
{
25-
inst = new HtmlPageContext();
36+
_inst = null;
2637
_poolManager = null;
2738
}
2839
#endif

0 commit comments

Comments
 (0)