/// <summary> /// Doesn't really work yet. /// </summary> /// <param name="blueprint"></param> public void CopyFX(Camera blueprint) { // Clean foreach (var fx in gameObject.GetCameraEffects()) { DestroyImmediate(fx); } int comps = gameObject.GetComponents <Component>().Length; VRLog.Info("Copying FX to {0}...", gameObject.name); // Rebuild foreach (var fx in blueprint.gameObject.GetCameraEffects()) { VRLog.Info("Copy FX: {0} (enabled={1})", fx.GetType().Name, fx.enabled); var attachedFx = gameObject.CopyComponentFrom(fx); if (attachedFx) { VRLog.Info("Attached!"); } attachedFx.enabled = fx.enabled; } VRLog.Info("That's all."); if (!SteamCam) { SteamCam = GetComponent <SteamVR_Camera>(); } SteamCam.ForceLast(); SteamCam = GetComponent <SteamVR_Camera>(); VRLog.Info("{0} components before the additions, {1} after", comps, gameObject.GetComponents <Component>().Length); }
/*/// <summary> * /// Doesn't really work yet. * /// </summary> * /// <param name="blueprint"></param> * public void CopyFX(Camera blueprint) * { * * CopyFX(blueprint.gameObject, gameObject, true); * FixEffectOrder(); * }*/ public void FixEffectOrder() { if (!SteamCam) { SteamCam = GetComponent <SteamVR_Camera>(); } SteamCam.ForceLast(); SteamCam = GetComponent <SteamVR_Camera>(); }
/// <summary> /// Doesn't really work yet. /// </summary> /// <param name="blueprint"></param> public void CopyFX(Camera blueprint) { CopyFX(blueprint.gameObject, gameObject, true); if (!SteamCam) { SteamCam = GetComponent <SteamVR_Camera>(); } SteamCam.ForceLast(); SteamCam = GetComponent <SteamVR_Camera>(); }