Files
hexapod-robot/2026-current/Hexapod_Simulation_Unity/Assets/HexapodSim/HexapodSimBootstrap.cs
T

18 lines
676 B
C#
Raw Normal View History

using UnityEngine;
namespace HexapodSim
{
// Adds the firmware simulation to whatever scene is playing, so Main.unity
// works without editing the scene. To configure it in the Inspector
// instead, add a HexapodSimulation component to any GameObject yourself;
// the bootstrap then does nothing.
static class HexapodSimBootstrap
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
static void AddSimulationIfMissing()
{
if (Object.FindAnyObjectByType<HexapodSimulation>() != null) return;
new GameObject("HexapodSimulation").AddComponent<HexapodSimulation>();
}
}
}