Soft-reference

What is soft-reference?

How does it work?

Why we can’t reference the turret and the barrel in C++

I did some research but I found nothing. can you give me a resource/s to dive in?

Thanks in advance

Edit: I think I can get the reference of barrel and turret by adding a tag name to each and in C++ I can call GetComponents() then we need to filter it to get the components that have the exact tag name we set it in the Editor, am I right?

Could you provide context please or at least the timestamp in the video (both would be great).

1 Like

No problem :slight_smile:

  1. First, I set a tag Component I called “BarrelRef”

  2. Second, I have changed the Signature of “SetBarrelReference” cuz I don’t need any parameters. then I did the filtering I mentioned in my Q.
    2

  3. third, I did an If Condition to test my Code

  4. Finally

What do you think? :slight_smile:

About the Soft-Ref Q
2:01 When Ben said "Once it’s worked all that out, it’s going to then

raise an event in Blueprint. Why in Blueprint? Well, because

what’s actually finally going to happen is, we’re going to rotate the turret and we’re going to elevate the barrel,

and those two things, the turret and the barrel are

assets and they want to be soft-referenced in Blueprint, so that should we want

to make a change to those assets, well they’re not hard coded by path, by

file name, in the C++. So, we make all our asset references in Blueprint. "

I don’t understand this part

What is soft-reference?

How does it work?

Why we can’t reference the turret and the barrel in C++

I did some research but I found nothing. can you give me a resource/s to dive in?

  1. You can just use FindComponentByClass instead of GetComponents.
  2. To be honest I’m not sure what Ben is talking about :sweat_smile:. I never liked the design of these classes. It’s far easier to just create the components in C++ with CreateDefaultSubobject, you don’t have to find components that way as they’re there on the tank class.
1 Like

I never liked the design of these classes.

I agree with you.

I searched again about soft-ref, but still struggling with it.

resources:

At 15:33

https://answers.unrealengine.com/questions/879172/can-someone-explain-soft-variable-references.html

is Soft-Ref relate to C++ or UE4?
All I want is to know Why Ben DID NOT explain what they are? and Why did Ben mention Soft-Ref in the lecture?
SHOULD I WORRY ABOUT THEM?
AFTER SEARCHING, all I know is the soft-Ref is just a path or like a web address that is loaded without its value(they won’t exist in the memory), so I can call it whenever I need it. but Hard-Ref will load all its dependencies and it will exist in the level(they will exist in the memory).
How does this relate to the lecture or Aiming Architecture?

thanks in advance.

None of that applies to what Ben is saying. Not sure why Ben says soft reference to be honest.

1 Like