Issue: Deleted files, restored them but still broken

I have a project with many assets and wanted to remove one seemingly unimportant package by manually deleting the folder. Appearently it had messed with a file in the PostProcessing asset folder, because I got an error. Reimporting didnt solve the issue.

I removed postprocessing manually by deleting the folder, then imported it again. Didnt help.

In the end, I manualy removed both Cinemachine and post processing stack, and reimported.
Even with the Vcameras removed, I end up with this error

Assets/Cinemachine/PostFX/CinemachinePostProcessing.cs(15,29): error CS0234: The type or namespace name PostProcessing' does not exist in the namespace UnityEngine.Rendering’. Are you missing an assembly reference?

This happened similarly once in the past. I solved it then by reinstalling Unity (more precesely installing the lastest version on top)

Update: Installed the latest verison and issue solved, but then the Recorder had similar issues. After a restart, it worked again, but anytime I move some asset files I get the same issue, or remove assets manually.

It’s a little difficult to follow this saga…
I can tell you that removing an asset isn’t necessarily enough. Some assets (PostProcessing is one of them) will define symbols in the Player Settings that will persist even after you remove the assets. You may have been tripping over something like this. In the case of PostProcessing, Cinemachine checks for those symbols, and depending on them will conditionally enable code that depends on PostProcessing being present. The error you quoted would be produced in that situation, if PostProcessing hadn’t been re-installed.
The upcoming version of Cinemachine has removed this dependency, so these problems will soon be a thing of the past.

Im sorry for beign unclear. So basically I removed cinemachine and post processing stack manually by removing the assets folder. My current issue is that Cinemachine has postprocessing scripts which are not finding their references. I am adding CineMachine and Post Processing Stack from the asset store (the ssset store tab download) and re-importing them, but to no availl.

So that is great news! When is this version? Should I install a beta version to solve this issue? I HAVE reinstalled post-processing, but the project will nto recognise it.

Part of the problem is that I have so many asset packages installed in the project, but much Im not using, and no safe way to remove entire packages. So I think a solution is to start a new project with CineMachine, Recorder, PostProcessing added, and import the scenes with their dependencies only. Does it sounds like a reliable solution? IVe hear dthat when you export a scne + dependencies, not all needed files are exported.

Your idea of starting fresh and importing what you need is not a bad idea. However I’m sure it’s still possible to rescue your original project.

I suspect the problem is in the defines. Check them like this:

3387287--266183--upload_2018-2-10_15-30-59.png

Then look here in the inspector:

3387287--266184--upload_2018-2-10_15-32-16.png

and remove any post-processing-related defines. Then the CM/PP glue code will no longer be included. Alternatively, you could just delete the CM files that are complaining about PP.

3387287--266182--upload_2018-2-10_15-29-46.png

Thank you. This solved my compile errors. My cinemachine camera cuts are gone and the vcams have Nothing selected. I think when I get PostProcessing from the asset store I get the old one, and I have to manually download V2 again. I will try to remove the asset folder again manually and replace it with the V2 downloaded from github

Isntalled V2 by moving it to the assets folder (the files + the PostProcessing folder). Now I get an issue with Fog.cs, can I just remove it? You mentioned deleting CM files. Which are those? THanks

I don’t know what Fog.cs is. Cinemachine scripts are in the Cinemachine folder.

1 Like

So I am stuck now. I have the Post Processing and Cinemachine imported, and the tools show up in the editor, and I can run Play, but my shots are not working. The issue is with Fog in PostPRocessing that has a missing reference (I think)

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.Rendering.PostProcessing.Fog.Render (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) (at Assets/PostProcessing/Runtime/Effects/Fog.cs:29)
UnityEngine.Rendering.PostProcessing.PostProcessLayer.BuildCommandBuffers () (at Assets/PostProcessing/Runtime/PostProcessLayer.cs:403)
UnityEngine.Rendering.PostProcessing.PostProcessLayer.OnPreCull () (at Assets/PostProcessing/Runtime/PostProcessLayer.cs:292)


Fog.cs

using System;

namespace UnityEngine.Rendering.PostProcessing
{
[Serializable]
public sealed class Fog
{
[Tooltip(“Enables the internal deferred fog pass. Actual fog settings should be set in the Lighting panel.”)]
public bool enabled = true;

[Tooltip(“Should the fog affect the skybox?”)]
public bool excludeSkybox = true;

internal DepthTextureMode GetCameraFlags()
{
return DepthTextureMode.Depth;
}

internal bool IsEnabledAndSupported(PostProcessRenderContext context)
{
return enabled
&& RenderSettings.fog
&& !RuntimeUtilities.scriptableRenderPipelineActive
&& context.camera.actualRenderingPath == RenderingPath.DeferredShading; // In forward fog is already done at shader level
}

internal void Render(PostProcessRenderContext context)
{
var sheet = context.propertySheets.Get(context.resources.shaders.deferredFog);
sheet.ClearKeywords();

var fogColor = RuntimeUtilities.isLinearColorSpace ? RenderSettings.fogColor.linear : RenderSettings.fogColor;
sheet.properties.SetVector(ShaderIDs.FogColor, fogColor);
sheet.properties.SetVector(ShaderIDs.FogParams, new Vector3(RenderSettings.fogDensity, RenderSettings.fogStartDistance, RenderSettings.fogEndDistance));

var cmd = context.command;
cmd.BlitFullscreenTriangle(context.source, context.destination, sheet, excludeSkybox ? 1 : 0);
}
}
}