Download

Casting and References

Hi guy, just looking for a bit of information.

I have a character, which has some components including a Stats component (keeps track of health etc). I also have a Sky BP which handles the dynamic sky (day/night cycles etc) placed in the level.

Now, I need to get a reference to the Sky BP from my Stats Component on my player as I need to regularly get information from the sky.

So, at the moment, my player character bp gets a reference to the sky and stores it when the player is spawned in. Now if i need to access the sky bp from my Stats Component fairly often, what is the best/cheapest way to do this?

Should I just get a reference to the player character and use it’s sky reference? Or, should I in begin play of my stats component get a reference directly to the sky bp (using get all actors of class) and then store that reference, or is there another way i’m missing or that might be better or cheaper. Or is there no real difference either way.

Thanks.

Just use the players reference.