Sky_Sphere BP equivalents in C++?

Hi All

I’m turning the Sky_Sphere BP into a C++ class in order to make certain gameplay events less complicated to repeatedly script in BP’s. I was wondering- the directional light actor that is referenced in the BP is an actor, not a component. So it looks as if the variable in the BP that references it would not be a subobject pointer in C++. Infact the directional light actor doesn’t appear in the components section of the BP. In order to do the same thing in C++, do I just spawn a directional light actor in the constructor and manipulate it within the class?

Thanks!

I don’t know, so this is only a comment, but did you already look up the base class of the Sky_Sphere BP?

It inherits from Actor- I’m making a C++ class that inherits from actor too. Was thinking that you cant spawn an actor inside of a constructor. So it would have to spawn at beginplay, which would probably mean that it wouldn’t be visible in the editor, as it is with the BP.

Ok, that makes sense in a way. Where could i find the Sky_Sphere BP to have a look at this myself? Is it in every FirstPersonTemplate?

Should be in all the 3D templates- I’m using 3rd person. You’ll see it in the scene outliner. Thanks!

Ah ok, you want to know where the DirectionalLightActor is Set. If you look close, it’s set to editable. If you select it in the scene outline, you can see it’s options on the right side.

http://puu.sh/cNIkX/702e3b5d12.png

You can also see the “DirectionalLightStationary” in the Scene outliner. It simply set by hand.

The construction script checks if you assigned a Light.

http://puu.sh/cNInO/61c10c0816.png

If not, it uses the sunlight etc to calculate the Light Direction and Sun Color Value for the Dynamic Sky Material.

http://puu.sh/cNIr1/6f00b6aff2.png

So for the c++ part, i would say you just need to have a Variabel of type “DirectionalLight” and make it editable.

Then you spawn a Directional Light over the Window in the upper left and set the variable with it by hand.

http://puu.sh/cNIvH/b00a48b441.png

Does this answer your question? (:

Oh of course! I completely forgot that I can make a C++ variable editable in BP!!! Thanks alot eXi!!

Hey eXi. Gotta problem with this;
I made a variable in the SkySphere class

UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "SkySphere")
ADirectionalLight* Sun;

However, it doesnt update when I try and put a directional light in it, in the editor blueprint. If I dont have EditDefaultsOnly, then it’s greyed out. Am I doing something wrong? Thanks!

Have you tried “EditAnywhere” instead of “EditDefaultsOnly”?

You can find the full list of UPROPERTY parameters here:

That didnt work. The strange thing is that after your answer, I made a variable in the persistent levelscriptactor for the skydome. I went into edit defaults on the level blueprint and set it to the skydome bp, works no problem. It only seems to be a problem with the light actor…

Give me a second to reconstruct that and test it.

So, i don’t really know why it is not working for you.

I created a class from AActor and only added this to the header file:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SkySphereTest")
	ADirectionalLight* MyTestDirectionalLight;

After that, i compiled the game (DebugGame Editor) and created a Blueprint from my new made Class. Then i placed it into my scene. After that, i searched it inside my Scene Outliner and selected it.

After this, i found my variable that i created in the options tab right under the scene outliner, clicked on it and selected the alread placed “DirectionalLightStationary”.

Did you place your BP inside your scene and tried to change the variable or did you, by mistake, tried to change the variable in the DefaultsTab of the BP itself?

EDIT: Here a picture:

http://puu.sh/cP6Qj/7c453b124a.jpg

http://puu.sh/cP6Qj/7c453b124a.jpg

I’ve followed all of those steps except that the variable is only visible in the BP by clicking “show inherited variables”. Even if I create a new BP from the class, the variable is not visible under the scene outliner. I’m trying to see what I’ve done thats different…

Ok its working- I think the change to EditAnywhere solved it, but then I was looking at the old compiled version by mistake. Thanks alot for your patience!!