I’ve got two classes that are identical other than name and an irrelevant enum:
using System.Collections.Generic;
using UnityEngine;
[ExecuteAlways]
public class SpeedometerNeedle : MonoBehaviour
{
SpinnerType spinnerType = SpinnerType.SpeedometerNeedle;
Spinner spinner = new Spinner();
public SpinnerSpinAxis spinAxis = SpinnerSpinAxis.Z;
public List<MeshFilter> meshFilters = new List<MeshFilter>();
public NeedleParams needleParams = new NeedleParams();
private void OnRenderObject()
{
if (needleParams.copyToTransform)
needleParams.copyToTransform.rotation = transform.rotation;
needleParams.WriteToSpinner(spinner, spinnerType, spinAxis, transform);
}
}
using System.Collections.Generic;
using UnityEngine;
[ExecuteAlways]
public class TachometerNeedle : MonoBehaviour
{
SpinnerType spinnerType = SpinnerType.TachometerNeedle;
Spinner spinner = new Spinner();
public SpinnerSpinAxis spinAxis = SpinnerSpinAxis.Z;
public List<MeshFilter> meshFilters = new List<MeshFilter>();
public NeedleParams needleParams = new NeedleParams();
private void OnRenderObject()
{
if (needleParams.copyToTransform)
needleParams.copyToTransform.rotation = transform.rotation;
needleParams.WriteToSpinner(spinner, spinnerType, spinAxis, transform);
}
}
These are tagged as [ExecuteAlways] but only one of them is working. If I stick a breakpoint in OnRenderObject() on both classes, the SpeedometerNeedle one gets hit but the TachometerNeedle one doesn’t. It worked yesterday, but not today. This was a problem in 2020 version so I updated to 2022.1.10f1, but it still doesn’t work.
Why?