This code should be in the Level Blueprint, OR the class that sun component resides.
How are you setting the reference for the Sun?