Hello,
I would like to pass in a parameter-name (variable) into my Method so that it can change it.
For example:
Texture2D _imageA;
Texture2D _imageB;
Texture2D _imageC;
ApplyColourEffect(Tint.Blue, out _imageC);
So now my ‘ApplyColourEffect’ method knows that it needs to repopulate the ‘_imageC’ with the processed effect.
My question is, on the ‘ApplyColourEffect’ method, how do I actually retrieve that output?
void ApplyColourEffect(Tint _tint, out _out) // ??
The object you passed in(_imageC in the example) would how be modified.
Your method signature should look like:
void ApplyColourEffect(Tint _tint, out Texture2D _out)
Because you modified the given object by it’s reference, all references pointed to that object when next getting or invoking something should have the changes applied to the object. You can pass back the Texture2D object, but you don’t need to, you already modified it and that again affects all references to that object since making the change in the ApplyColourEffect method.