public void Init(Saber parentSaber) { Console.WriteLine("Replacing Trail"); saber = parentSaber; if (gameObject.name != "LeftSaber" && gameObject.name != "RightSaber") { Console.WriteLine("Parent not LeftSaber or RightSaber"); Destroy(this); } if (saber == null) { Console.WriteLine("Saber not found"); Destroy(this); } SaberWeaponTrail oldtrail = Resources.FindObjectsOfTypeAll <GameCoreInstaller>() .FirstOrDefault()?.GetPrivateField <BasicSaberModelController>("_basicSaberModelControllerPrefab") ?.GetPrivateField <SaberWeaponTrail>("_saberWeaponTrail"); if (oldtrail != null) { try { ReflectionUtil.SetPrivateField(oldtrail, "_multiplierSaberColor", new Color(0f, 0f, 0f, 0f)); oldColorManager = ReflectionUtil.GetPrivateField <ColorManager>(oldtrail, "_colorManager"); oldTrailRendererPrefab = ReflectionUtil.GetPrivateField <XWeaponTrailRenderer>(oldtrail, "_trailRendererPrefab"); oldtrail.gameObject.SetActive(false); } catch (Exception e) { Console.WriteLine(e); Console.WriteLine(e.Message); throw; } trail = gameObject.AddComponent <CustomWeaponTrail>(); trail.init(oldTrailRendererPrefab, oldColorManager, PointStart, PointEnd, TrailMaterial, TrailColor, Length, MultiplierColor, colorType); } else { Console.WriteLine("Trail not found"); Destroy(this); } }