After setting up the Post Processing volume I have this random blue spark of light randomly appearing in my game that I cannot track back to any of my GameObjects, this random glitch appears in completely random moments and lasts less than half a second, image below:
Yup, the effect definitely looks like bloom, I agree, but I don’t know what is causing the issue, I am also just using one Post Processing Volume so the only bloom effect is the global effect which is affecting everything in the Scene.
I’d say change the bloom values while playing to see the result
Maybe if you set the post processing grading to HDR it will improve? This way you can use with brightness values higher than 1 (at a potential performance cost)
I am spawning them around the player and when the player moves if a star is outside the range of the player the position of the star is moved to be within the camera.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraEffects : MonoBehaviour
{
[SerializeField]
private float windowSize = 10f;
[SerializeField]
private int stars = 1000;
[SerializeField]
private GameObject[] starPrefabs;
public static int starsActive = 0;
private void Start()
{
starsActive = 0;
}
// Update is called once per frame
void Update()
{
Vector3 center = SpawnManager.player ? SpawnManager.player.transform.position : Vector3.zero;
if (starsActive < stars)
{
GameObject newStar = Instantiate(starPrefabs[Random.Range(0, starPrefabs.Length)]);
newStar.transform.position = center + new Vector3(Random.Range(-windowSize, windowSize), Random.Range(-windowSize, windowSize));
starsActive++;
}
}
}
using UnityEngine;
public class Star : MonoBehaviour
{
public void Update()
{
if (!SpawnManager.player) return;
if ((transform.position - SpawnManager.player.transform.position).sqrMagnitude > 225f)
{
transform.position = SpawnManager.player.transform.position + GetPlayerDirection() * 15 + new Vector3(Random.Range(-20f, 20f), Random.Range(-20f, 20f), 0f);
}
}
private Vector3 GetPlayerDirection()
{
return SpawnManager.player.transform.GetChild(0).transform.position - SpawnManager.player.transform.GetChild(0).transform.parent.position;
}
}
The problem is that I have seen that the bug happens even when the Time.timeScale = 0 (when the game is paused).