Also receiving error on unload when reloading it.
o.reload MarkerDistance
Failed to call hook 'Unload' on plugin 'MarkerDistance v1.2.0' (NullReferenceException: Object reference not set to an instance of an object) at Oxide.Plugins.MarkerDistance.Unload () [0x00044] in <40c790ec255c443cb52e0c87155cb4f1>:0
at Oxide.Plugins.MarkerDistance.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x0005b] in <40c790ec255c443cb52e0c87155cb4f1>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <87ce9ac9776a48658bc55eae6debe38b>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <18d4f19bbc844191b11ed9e69284d09b>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <18d4f19bbc844191b11ed9e69284d09b>:0Unloaded
plugin Marker Distance v1.2.0 by Notchu
Loaded plugin Marker Distance v1.2.0 by Notch
Fixed by changing the Unload from
CHANGED FROM
void Unload()
{
foreach (var user in _users)
{
CuiHelper.DestroyUi(user, "markerDistanceBackground");
}
_users.Clear();
_distanceTimer.Destroy();
}
CHANGED TO
void Unload()
{
if (_users != null)
{
foreach (var user in _users)
{
if (user != null)
{
CuiHelper.DestroyUi(user, "markerDistanceBackground");
}
}
_users.Clear();
}
if (_distanceTimer != null)
{
_distanceTimer.Destroy();
_distanceTimer = null; // Set it to null after destroying
}
}
That resolved the error, however, the marker distance doesnt show. I just get the typical marker. Example Yellow or Red whatever color marker it is. No distance.