Casting and storing a reference from a function?

Simple question, is there any room for weird occurrences from casting from a function? And why?

Hello RyanSergent,

There shouldn’t be any issues doing this. The only thing to look out for is that, if you wish to store a reference to the casted object and use it outside of the function, you’ll need to create the variable outside of the function so that it isn’t limited to the scope of the function.

Have you run into any problems trying to do this?