Change/Create Public variables in runtime

Hi!

I would like change or create variables depending on a choice, for example from an enumeration.
But I’ve not seen any way to create any kinds of variables in runtime using blueprint.

To easier explain what I mean I’ve taken a camera actor as an example:

Under Camera Settings change Projection Mode between Perspective and Orthographic.

See how the every variable change from being: Field of View, Constrain Aspect Ration, Aspect ration

127301-1.png

to ortho Width, Ortho Near Clip Plane and Ortho Far clip Plane

127302-2.png

  • Is this somehow possible to do in Blueprints?
  • Is it somehow possible to do in C++?
  • How is it possible?

Yes its possible within Blueprints and within C++. You can create variables to hold things like the Mode, FOV, etc, and then set those values through the blueprint whenever (in response to the player hitting a volume, changing an option, etc).

You should go ahead and read through these tutorials to get a better understand of variables and functions in Blueprints:

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Variables/index.html

and this tutorial takes you through actually modifying a Camera using blueprints:

https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/UsingCameras/Blueprints/index.html

Hi ExtraLifeMatt

Thank you for such a quick answer but sadly this is not what I was asking for.

I’m fully aware that you can create all kinds of variables and manipulate these in different way in both Blueprints and C++.

What I’m asking for is to create and make these variables public for others without them having to create these themselves in Blueprint or C++.

What I would like is this process to be somehow automated depending on different choices.

Like my example with the enumeration or the already existing example in the camera actor.

I will attach a couple of images how this i handled manually in blueprint.
First I want to create a variable

127422-1.png

I then want to make it public

127425-3.png

And be able to manipulate it by selecting the actor in the editor.

127426-4.png

As I also mentioned and showed earlier about the Camera Actor, notice how the the variables change (gets hidden/shown/gets created) in the Details panel depending on the choice selected in the Projection Mode enumeration tab.

Ah, I think I see what you are asking for. My apologies for the confusion.

In C++, object properties(variables) can go through specialized code that shows/hides/re-arranges them based on whatever logic you want. All those variables on the Camera Actor were always there, they’re just hidden based on what value you set your Projection Mode to.

However, there isn’t anything like that for Blueprints.

You could probably automate the creation of a class/detail layout customization, but you’d need some intermediate data structure (like an Excel spread sheet or simple text file using some custom scripting language), and then a tool that runs and spits out all the C++ classes (which can be Blueprints) when you build the game. Do-able, but it would require some hefty C++ work and you’d lose one of the main benefits of Blueprints which is you don’t have to recompile the project when you add a new Blueprint variable.

Hi again ExtraLifeMatt

Thanks once again for answering so quickly.

After looking at your comment and later inspecting the cameras C++ code I understand what you mean.

While this doesn’t solve my problem I find it highly useful for development with Blueprint actors in the future.
I will continue to learn how C++ integrates in with Blueprints and continue my research.

Thank you very much for your help!

Hey,

Would be a very useful stuff, I just post a feature request, hope it would be possible in Blueprint.