Lets say I need to store the original Light Intensity value of several light components inside a an actor blueprint. Do I have any way to store custom float values inside each light component so that I can later refer back to the original intensity value of each? If not, what is the recommended method to store these original property values on BeginPlay?
There are several ways to do it, from extending a light scene component to just an array of values or structs.
Are your lights all of the same type (point, spot, …)?
If you chose to extend a light scene component: create a scene component, set the parent class:
Then in your BP class, add the above light components and save/restore the intensity values:
You also can use data tables to store any constants
To access this date you just need to use GetDataTableRow node
Thanks @EvilCleric & @Yaklakootmaa2! The lights may be of different type. They are placed inside BP actors than inherit a common parent class. So on Begin Play this custom parent class needs to loop through the child’s lights and ‘somehow’ store their Intensity for later use. I know how to loop the light components and how to get their intensity etc… This is already implemented.
What I’m not sure about is how/where should I store these initial values given an artist is dropping the lights inside the child BP, not a developer, so the parent class has to handle all the logic. My first guess is to store the values inside an array but I’m not sure what type of [2D?] array can I use store both the ID of the light and its intensity. Do I need to setup a struct? Or alternatively, is there any way to store custom values inside the light components at runtime (without extending the light in advance)?
You can use any kind of array or another data type that is able to store variables that are needed for your purpose.
For example, for min/max float values I like to use vector 2D, because it is enough for my purposes.
Hi @Yaklakootmaa2, but how do I reference these array values back to each light component if just Add all the values to the array?
@Yaklakootmaa2 Lets say I store the values of 4 lights (A, B, C D) in that array, how do I retrieve the value of C if I don’t know the index number?
You can go through the array and compare each ref with the light until you find the equal one.
Or you can use Find node to find exact key in the map dictionary to get variable for this key