Skip to content

Commit 70906e5

Browse files
committed
Fixed fps drop when showing tofu timer
1 parent 30c547e commit 70906e5

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

WarmTofuMod.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
namespace WarmTofuMod
1515
{
16-
[BepInPlugin("com.kert.warmtofumod", "WarmTofuMod", "1.5.1")]
16+
[BepInPlugin("com.kert.warmtofumod", "WarmTofuMod", "1.5.2")]
1717
public partial class WarmTofuMod : BaseUnityPlugin
1818
{
1919
public enum Menus
@@ -33,6 +33,7 @@ public enum Menus
3333
bool achievements100kmh = false;
3434
bool achievements200kmh = false;
3535
bool inTuningMenu = false;
36+
static SRToffuManager tofuManager;
3637

3738
// used to get data from private fields with reflection
3839
const BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;
@@ -442,7 +443,9 @@ static void ShowTofuTimer()
442443
{
443444
if (buttonStyle == null)
444445
InitMenuStyles();
445-
int tofuTimer = (ObscuredInt)typeof(SRToffuManager).GetField("Compteur", bindingFlags).GetValue(GameObject.FindObjectOfType<SRToffuManager>());
446+
if(!tofuManager)
447+
tofuManager = GameObject.FindObjectOfType<SRToffuManager>();
448+
int tofuTimer = (ObscuredInt)typeof(SRToffuManager).GetField("Compteur", bindingFlags).GetValue(tofuManager);
446449
GUILayout.BeginArea(new Rect((float)(Screen.width / 2) - 120f, (float)Screen.height - 50f, 800f, 100f));
447450
GUIStyle guistyle = new GUIStyle();
448451
guistyle.font = buttonStyle.font;

WarmTofuMod.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<AssemblyName>WarmTofuMod</AssemblyName>
66
<Description>Initial Drift Online mod by Kert</Description>
7-
<Version>1.5.1</Version>
7+
<Version>1.5.2</Version>
88
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
99
<LangVersion>latest</LangVersion>
1010
</PropertyGroup>

0 commit comments

Comments
 (0)