# How to: Object reference while casting

**URL:** <https://forums.unrealengine.com/t/how-to-object-reference-while-casting/156221>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [January 12, 2021, 2:16pm UTC](https://forums.unrealengine.com/t/how-to-object-reference-while-casting/156221 "2021-01-12T14:16:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_e4662743](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e4662743](https://forums.unrealengine.com/u/anonymous_user_e4662743)\
**Post date:** [January 12, 2021, 2:16pm UTC](https://forums.unrealengine.com/t/how-to-object-reference-while-casting/156221/1 "2021-01-12T14:16:32Z")

</div>

Good afternoon,

I am fairly new to Unreal Engine and currently working on a university project. I am creating a simulation environment and want that the user is able to change the sun settings over a widget. Currently I am working with a Game Instance and Event ticks, as seen in the picture, which is not really ideal. I would like to directly cast to the variable in the BP\_Sky\_Sphere but struggle to find the right object reference. I know I am lacking in basic knowledge but every help is much appreciated!

 ![Capture.PNG](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/e/0e7a7c1ef9d2862c56b268743d31f60dabcab92b.png)

---

<div class="post-metadata">

**Author:** ![Est\_engine](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/est_engine/32/1008648_2.png) [@Est\_engine](https://forums.unrealengine.com/u/Est_engine)\
**Post date:** [January 13, 2021, 8:17am UTC](https://forums.unrealengine.com/t/how-to-object-reference-while-casting/156221/2 "2021-01-13T08:17:33Z")

</div>

> [@anonymous\_user\_e4662743](#):
>
> Good afternoon,
> 
> I am fairly new to Unreal Engine and currently working on a university project. I am creating a simulation environment and want that the user is able to change the sun settings over a widget. Currently I am working with a Game Instance and Event ticks, as seen in the picture, which is not really ideal. I would like to directly cast to the variable in the BP\_Sky\_Sphere but struggle to find the right object reference. I know I am lacking in basic knowledge but every help is much appreciated!
> 
> ![Capture.PNG](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/e/0e7a7c1ef9d2862c56b268743d31f60dabcab92b.png)

Hi man,  
you dont need to Cast-To  
The skysphere is an actor that is literally in the scene,  
you can get the reference to it directly, getting the " first actor" in the scene of " skysphere" type  
Renenber to refresh the material to see the changes

 ![Cast_to_Skysphere.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/8/7/8768cee64a26afe5588b8ec7b7711a9f88f1422e.jpeg)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e4662743](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e4662743](https://forums.unrealengine.com/u/anonymous_user_e4662743)\
**Post date:** [January 13, 2021, 8:47am UTC](https://forums.unrealengine.com/t/how-to-object-reference-while-casting/156221/3 "2021-01-13T08:47:02Z")

</div>

@Est_engine Thank you so much, really appreciate that you took the time to help me! It works perfectly 🙂
