it comes from object oriented programming languages, which all have these concepts: class is the declaration of objects that you create (instantiate) when you run the code. so the class is the blueprint specification for one or more instances of objects based on that class blueprint.
yeah i imagine that's where the word blueprint come from too, because a class is a "blueprint" for what an object should be like. Clever naming on epic's apart, makes it a little confusing to explain though XD
So i am trying to reference an object (/children) with scaleable levels, (and data assests of its stats). I’m trying to reference the object from a Widget. The widget is in the viewport of (and hovering over) the object. I’m having issues trying to reference (establish ownership) the objects BP. I need the level of the object (children) to calculate stats from its data assets. GPT suggests that simply placing the widget in the object blueprints gives it ownership. I haven’t tried the class reference, but i’m trying to determine if i’m going about this the right way. Just assume the object and its children have independent levels from one another. When overlapping the box collision, the ui spawns above it. It has stats like the current level, the name of it, the price to upgrade, ETC. (Which increments based on its level)
Hey, great explanation, so since my character blueprint is always loaded in my game, can i have a class reference to it inside my Player Controller or other blueprint classes that also always exist in my level without memory issues?
If I understand it correct the class reference is like using the Static keyword in general OOP wich then refers to the class itself and not its instances. I use this mostly when I want to use a class for storing data that can then be accessed by other classes for data sharing/saving purposes as well as the main parameters for the entire game/program, like a singleton. Im not so sure how useful that specific usage is in Unreal however since as I understand the variables in every single class other then the GameInstance are always reset to their default values upon loading a new level and so the GameInstance is the only place in Unreal Engine that can be used to store values and data across the entire game, things like game progress, the last level and other things that you dont want to be lost upon loading the next level but carry over across the entire game need to be in the GameInstance or a savefile.
anything that exists inside a world in unreal will be reset to it's default values (which includes game modes and player controllers since they are also tied to a level) things like assets that exist outside of the world though, are persistent (writing to a data asset will persist between levels, just not between play sessions, when you close and restart the game you'll find them reverted back to default too) Within blueprint i dont think it is possible to write to a class itself. but you can read the class default values! which can be useful in some cases but generally, not too much. but long story short, yeah working with class references is pretty much like accessing static members in normal OOP.
it comes from object oriented programming languages, which all have these concepts:
class is the declaration of objects that you create (instantiate) when you run the code. so the class is the blueprint specification for one or more instances of objects based on that class blueprint.
yeah i imagine that's where the word blueprint come from too, because a class is a "blueprint" for what an object should be like. Clever naming on epic's apart, makes it a little confusing to explain though XD
So i am trying to reference an object (/children) with scaleable levels, (and data assests of its stats). I’m trying to reference the object from a Widget. The widget is in the viewport of (and hovering over) the object. I’m having issues trying to reference (establish ownership) the objects BP. I need the level of the object (children) to calculate stats from its data assets. GPT suggests that simply placing the widget in the object blueprints gives it ownership. I haven’t tried the class reference, but i’m trying to determine if i’m going about this the right way.
Just assume the object and its children have independent levels from one another. When overlapping the box collision, the ui spawns above it. It has stats like the current level, the name of it, the price to upgrade, ETC. (Which increments based on its level)
this is my favorite UE Tutorials channel
Thanks!
@@thegamedevcave I agree, this is the best channel for me. He makes sense!
Hey, great explanation, so since my character blueprint is always loaded in my game, can i have a class reference to it inside my Player Controller or other blueprint classes that also always exist in my level without memory issues?
Exactly!
If I understand it correct the class reference is like using the Static keyword in general OOP wich then refers to the class itself and not its instances. I use this mostly when I want to use a class for storing data that can then be accessed by other classes for data sharing/saving purposes as well as the main parameters for the entire game/program, like a singleton. Im not so sure how useful that specific usage is in Unreal however since as I understand the variables in every single class other then the GameInstance are always reset to their default values upon loading a new level and so the GameInstance is the only place in Unreal Engine that can be used to store values and data across the entire game, things like game progress, the last level and other things that you dont want to be lost upon loading the next level but carry over across the entire game need to be in the GameInstance or a savefile.
anything that exists inside a world in unreal will be reset to it's default values (which includes game modes and player controllers since they are also tied to a level)
things like assets that exist outside of the world though, are persistent (writing to a data asset will persist between levels, just not between play sessions, when you close and restart the game you'll find them reverted back to default too)
Within blueprint i dont think it is possible to write to a class itself. but you can read the class default values! which can be useful in some cases but generally, not too much.
but long story short, yeah working with class references is pretty much like accessing static members in normal OOP.
super useful thanks!
Glad it was helpful!
thx, useful for sure.. (pls highpass your audio before upload to avoid the keystrokes sub frequencies destorying my woofers)
Thanks, will do!