I have the “PostProcessingUtilities” asset by keijiro, which I downloaded from his GitHub page, and I want to be able to control the Post Processing Stack effects from within my own scripts.
This is what I have so far:
using UnityEngine.PostProcessing.Utilities;
//Other "using" lines here.
//My class declaration here.
public PostProcessingController myEffects;
public Camera UICam;
void Start () {
UICam = GameObject.Find ("UICamera").GetComponent<Camera> ();
myEffects = UICam.GetComponent<PostProcessingController> ();
}
void Update () {
chromaticAberration.intensity = chromaticAberrationCurve.Evaluate (chromaticAberrationCurveTime);
}
}
I tried doing this in various ways. Like “PostProcessingController.chromaticAberration” instead of the current like in “Update”. And “myEffects.chromaticAberration”.
I also tried doing different things in “Start”, like just calling “myEffects” and forgetting the “Camera” component and object completely. But that just shows other errors, so I stuck with the original.
I’m pretty sure I’m making a correct reference to the script, and if I use “chromaticAberration.intensity” in the Controller script, there’s no errors.
I have the curve assigned and everything. I just didn’t include it as it’s not a relevant part of this problem.
The current error I’m getting, is the “does not exist in the current context” for “chromaticAberration”.
Any ideas what I’m doing wrong?
nwm, got it working.
All I had to do was put “myEffects.” in front of “chromatiAberration.intensity”. I didn’t even need to make a reference to the camera, or assign anything to it or to “myEffects”.
Hey, can you help me with this thing? I want to use the color grading using another script so that i can change the hue shift values in realtime(in game mode) on the canvas with a ui slider.
@Denisowator
I haven’t used this in a long time, but I’ll re-download keijiro’s asset (if it’s still available and functioning). And I’ll try to set it up again. I am currently working on something that needs to be done by the end of this week. And I’m really busy during the week days, so I’ll do it next week, if that’s fine with you.
In your case, I think you would have to just set the slider values to the min-max of the color grading effect (whichever color grading effect you want to change). So that if you put the slider to the left, when it hits the end, it will also hit the bottom value for that effect. And the same for the right side (unless you of course want to not allow people to put the effect to its minimum or maximum values). You’d then have to assign the effect value, to the current value of the slider. So when you move the slider, the effect value changes with it. So it’s basically like copying the Inspector window slider from that script, and slapping it onto the game screen.
Keep in mind what I said in my first reply to this thread. You need to put your controller script reference variable, in front of whatever you’re trying to change (myEffects.chromaticAverration.intensity). I also said that you don’t need to reference anything to the script reference, but that seems like it wouldn’t work, and you’d have to find the object the script is in, then do “GetComponent” for that script. I’ll check it next week once I re-downloaded the asset.
Hope this helps. Please let me know if you get it working, and if you have trouble, I will check the asset next weekend. Also, please ask the asset creator for permission if you plan to distribute your project in any way (commercial, non-commercial, etc).
I don’t have a GitHub account, but from what I can see, you can view the creator’s email once you log in.
Here’s the asset link: GitHub - keijiro/PostProcessingUtilities: Utility scripts for the post processing stack
And here’s the creator’s repositories (with his info in the left): keijiro (keijiro) / Repositories · GitHub
I am a newbie to Unity. Actually, I was building a color blindness correction app by shifting hue. It’s a college project and is due on the 9th.
Well, I understood the concept of this thing working as a whole but I am failing to get the proper code to get my slider running. I need help with the code.
I know you’re busy and I am really sorry bothering you, but this was the only thread I found wherein someone tried using a separate script to control the post-processing utility.
If you could manage some time, it will be a great help and I owe you one big time.
Okay, I’ll try to set it up as early next week as possible. I’m working on something that needs to be finished before next week, so if I finish early, I can get an early start on the hue slider.
The hue slider shouldn’t take me more than a few hours.
I could do the whole hue slider setup and code for you and give you it, with commented code. Or I could just help you with the code. Whatever you prefer. I don’t exactly know how much you’ve managed to do of it on your own.
Do you have a physical slider on-screen that you can manipulate, and you just need the hue changing thing, or do you need help with the slider setup as well?
I’m assuming you want this written in C#, since UnityScript is being deprecated (if not already fully deprecated). And what Unity version are you using? The version number can be found both on the shortcut name, and at the top left of the Unity bar, when you have a project open.
I am using Unity 2017.3.0f3. I have my slider ready on the canvas. Need the code and a walkthrough on how to set that up.
Again, thank you so much for helping out.
In terms of setting it up, all you’d need to do, is put the script (the one I’ll make for you) somewhere in the project hierarchy (as an object component). In the code, I’ll put comments above the various object references and state which objects the code would need to go into, to be functional. Because if the script was a component of the slider, or some completely unrelated object, the references would look slightly differently, for the sake of best-practice. I’ll also put possible reference alternatives in the code, if you wish to put the script wherever.
Also,
HighlevelHappyFlies
Just fyi, I’ll get started on it tomorrow, should also have it done tomorrow.
Hi,
Sorry for the delay. I had to do something today as soon as I got home, and it took longer than expected.
Here’s a full package. It includes the following:
- Post Processing Stack
- Post Processing Utilities
- Fully working example scene
- A Post Processing Profile
- The script used to change the hue using the slider
I’d suggest importing it in a new project, or backing up your current project and importing it into that. If you put it in a new project, just take out my script and the controller assets. And place them in your project. Also make sure to place my script in the appropriate object (indicated by the comments).
If you are unclear on anything, or are having any problems at all, please let me know.
Package Download
A note for anyone else using this asset, or planning on using it. Some of the effects aren’t what you think they might be. For example, if you want to access the hue shift property of the Post Processing Stack, you would need to do “colorGrading.basic.hueShift” as opposed to “colorGrading.hueShift” which is what I was originally trying to use in my script.
To find out exactly what variable names are assigned to the different effects, select the camera object with the post processing controller script, and create a new animation. If you add a property (and expand the controller script), you will get a list of all the effect variable paths (like colorGrading.basic.hueShift).