RemoveFunction
void RemoveFunction(Action function);
Removes a function from the internal Threadpool. If called during Unity’s update call, the current frame remains unaffected, and the removal occurs immediately after the update is finished.
Parameters
function
Function to be removed. Only takes functions with no parameters and no return value.
Example
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ContactSwitch : ThreadHarmonizerEngine.MonoBehaviourMultithreaded
{
// Start is called before the first frame update
void Start()
{
AddFunction(Sparkle);
}
void Sparkle()
{
// Some fancy effects, so players notice me
}
private void OnDestroy()
{
DisableMultithreading();
}
private void OnDisable()
{
DisableMultithreading();
}
private void OnEnable()
{
EnableMultithreading();
}
private void OnCollisionEnter(Collision collision)
{
RemoveFunction(Sparkle);
}
}