When I try to select an actor from my scene to use in my c++ project, I see my actor in the browse menu, but when I click it, the property still says “None”. Here is the declaration of my pointer :
This was working fine until last night, for no apparent reason. I went and tried to play my game, but the property no longer pointed to my directional light, and I couldn’t set it anymore. What could be the problem?
What class are you adding your directional light component to? Is this going into a class based on actor, character, game mode, etc.? Can you post the class (.h and .cpp) where you’re creating the directional light component?
I am adding the component to a subclass of AGameMode. I am not creating the directional light through c++, I am adding it to my level through the editor. I need to access it from my custom game mode to make a day-night cycle.
Game mode is mainly used for setting the rules of how the game works. Since a day-night cycle would affect the level that you are playing in, the setup for the cycle would best fit in the Level Blueprint. Let me know if the following tutorial helps in setting up your cycle.
Using the level blueprint would be the least complicated solution. The directional light class in the engine is marked with Minimal API which limits the ability to extend this class / create a pointer to an object of this type. If you are trying to exclusively use code you may find another community member on the forums who has attempted to do so.