top of page

CAMERA FADE EFFECT

Optimising Code Efficiency

- BRIEF - 

 

"Modern Solutions for Medieval Problems" is an FPS project I am in the process of developing. The camera fade-in process I had implemented involved creating game objects with attached materials that would be accessed by a script to alter the transparency. This was a cumbersome process that could be better handled using a single script.

​

I first looked online for existing solutions, which returned several results, but many involved placing game objects in the world also, or doing some form of material manipulation on a physical object. A solution I eventually found worked in line with what I had originally envisioned.  

​

UnifyWebsiteAnswer.PNG

First Solution

After implementation, a flaw was apparent in the inability to easily update crucial variables from the engine inspector window. Some changes fixed this, however the final result was not very intuitive. In previous projects I had tied transitioning values to an animation curve with success. As the alpha value of a texture in Unity is held between 0 and 1, an animation curve would be a much better tool for a designer to utilize in visualising the camera fade effect over a short period of time. I continued searching and found a simpler script that included a few Unity Scripting Attributes I had not used before and met the requirements I was looking for.

​

Running the game with the new script perfectly creates a camera fading in effect at the start of the level which could be easily altered with the animation curve in the inspector. There was no more need for cumbersome game objects filling the scene or character hierarchy.

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

 

 

 

 

 

 

 

 

 

 

 

​

​

​

​

- WHAT I LEARNT -

I had found multiple solutions that allowed me to better manage my camera fading effects through the use of a single script, but only one that offered intuitive user control through the engine inspector via the implementation of animation curves.  In doing this, I have cleared unnecessary assets from the game files optimizing relative code and game systems.

NewFadeScript.PNG
NewInspector.PNG

Second Solution with User Experience in Mind

Second Solution as Visible in the Unity Inspector

bottom of page