EXPLAINING Unreal's Object Reference VS Class Reference!

Поділитися
Вставка
  • Опубліковано 4 лют 2025

КОМЕНТАРІ • 14

  • @Chris-op7yt
    @Chris-op7yt 7 місяців тому +1

    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.

    • @thegamedevcave
      @thegamedevcave  7 місяців тому

      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

  • @EternalRecurrence88
    @EternalRecurrence88 12 годин тому

    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)

  • @dragondev2617
    @dragondev2617 7 місяців тому

    this is my favorite UE Tutorials channel

    • @thegamedevcave
      @thegamedevcave  7 місяців тому +1

      Thanks!

    • @BOLTONSOFT
      @BOLTONSOFT 5 місяців тому +1

      @@thegamedevcave I agree, this is the best channel for me. He makes sense!

  • @velha2999
    @velha2999 11 днів тому

    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?

  • @johnpekkala6941
    @johnpekkala6941 7 місяців тому

    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.

    • @thegamedevcave
      @thegamedevcave  7 місяців тому

      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.

  • @lslees_6192
    @lslees_6192 7 місяців тому

    super useful thanks!

  • @MaraldBes
    @MaraldBes 7 місяців тому

    thx, useful for sure.. (pls highpass your audio before upload to avoid the keystrokes sub frequencies destorying my woofers)