Skip to content

Commit e663dba

Browse files
committed
Fix override font stopping working after a while in IL2CPP
1 parent 2a5add5 commit e663dba

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/XUnity.AutoTranslator.Plugin.Core/TextTranslationInfo.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,11 @@ public void ChangeFont( object ui )
144144

145145
if( oldMaterial != null && newMaterial != null )
146146
{
147-
if( !_FontMaterialCopies.TryGetValue( oldMaterial, out var copyMaterial ) )
147+
if( !_FontMaterialCopies.TryGetValue( oldMaterial, out var copyMaterial )
148+
#if IL2CPP
149+
|| copyMaterial.m_CachedPtr == IntPtr.Zero
150+
#endif
151+
)
148152
{
149153
copyMaterial = _FontMaterialCopies[ oldMaterial ] = UnityEngine.Object.Instantiate( oldMaterial );
150154

0 commit comments

Comments
 (0)