The public shader used _Time incorrectly, causing a flicker on Day 3.
Solution: In your MalevolentGlow.shader, replace all _Time.y with frac(_Time.y) to prevent overflow.
Beginners often leave variables public to edit them in the Inspector. However, this makes them susceptible to being reset on scene changes or saved incorrectly.
The "Day 3" fix usually involves:
The keyword “malevolent planet unity2d day1 to day3 public fixed” implies a specific patch. Here is the exact changelog from version 1.2.1: malevolent planet unity2d day1 to day3 public fixed
Goal: Ensure the planet’s hostile actions occur at predictable, physics-aligned intervals.
Key Concept – FixedUpdate:
Unity’s physics system runs at a fixed timestep (default 0.02 seconds). FixedUpdate is called exactly once per physics tick, regardless of frame rate. For a malevolent planet affecting Rigidbody2D gravity, this is mandatory. The public shader used _Time incorrectly, causing a
Revised Script – PlanetMalice.cs (Day 2):
using UnityEngine;public class PlanetMalice : MonoBehaviour public float gravityIncreasePerSecond = 0.5f; public float maxGravity = 15f; public float shakeInterval = 3f; public float shakeIntensity = 0.2f; Why FixedUpdate is essential: If gravity increased in
private Rigidbody2D playerRb; private float originalGravity; private float shakeCooldown; void Start() playerRb = GameObject.FindGameObjectWithTag("Player").GetComponent<Rigidbody2D>(); originalGravity = playerRb.gravityScale; shakeCooldown = shakeInterval; void FixedUpdate() // ← Physics-step aligned // Increase gravity in fixed steps if (playerRb.gravityScale < maxGravity) playerRb.gravityScale += gravityIncreasePerSecond * Time.fixedDeltaTime; // Shake timer using fixed delta shakeCooldown -= Time.fixedDeltaTime; if (shakeCooldown <= 0f) ShakePlanet(); shakeCooldown = shakeInterval; void ShakePlanet() // Apply positional shake (visual only, not affecting physics) transform.localPosition = Random.insideUnitCircle * shakeIntensity; // Reset position next FixedUpdate (simplified)
Why FixedUpdate is essential:
If gravity increased in Update() (frame rate dependent), a player on 144 FPS would experience slightly different gravity deltas than one on 60 FPS, even with Time.deltaTime, due to floating-point accumulation over many small steps. FixedUpdate guarantees consistency across all devices. The malevolent planet becomes deterministic—hostile in the same way for every player.
Public variables still in use:
gravityIncreasePerSecond remains public. Now it works with Time.fixedDeltaTime, meaning “increase gravity by 0.5 per second” is physically accurate.