'Unity URP VolumeComponent Could Not Be Found & Cannot Convert From Vignette To Volume Profile
I'm trying to create an animated vignette, but I am unable to reference it in code. On my script attached to the Global Volume, I wrote:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class DyingFade : MonoBehaviour
{
public Volume vol;
public Vignette vig;
void Start()
{
Vignette tempVig;
if(vol.profile.TryGet<Vignette>(out tempVig))
{
vig = tempVig;
}
}
}
I am getting the following two Errors, specifically at the TryGet statement:
The type or namespace name 'VolumeComponent' could not be found (are you missing a using directive or an assembly reference?)
The type 'UnityEngine.Rendering.Universal.Vignette' cannot be used as type parameter 'T' in the generic type or method 'VolumeProfile.TryGet<T>(out T)'. There is no implicit reference conversion from 'UnityEngine.Rendering.Universal.Vignette' to 'UnityEngine.Rendering.VolumeComponent'.
Any help would be appreciated
Solution 1:[1]
For anyone who has the same error, I had to uninstall and reinstall the URP Package, and it worked.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jack Martin |
