‫Hey, welcome back.
‫In this video, we're going to make the distinction between instances of a particular blueprint class
‫versus the default blueprint, which is the blueprint that applies to all instances.
‫We're also going to see how we can assign, read or write access for a particular C++ variable in blueprints.
‫So let's get started.
‫We're now ready to start exposing some of our components to Blueprint.
‫So here we have our components and we've seen that if we click on each one of them, our details panel
‫is completely empty.
‫So we need to learn how we can expose certain properties to blueprint, and we do that by the use of
‫our U property macro.
‫So let's jump back into VS code and take a look at the You property macro.
‫This is a special macro.
‫It's unique to Unreal Engine and it's got this set of parentheses because it can take input parameters
‫now in order to show how to expose things in certain ways, we're just going to create a couple of throwaway
‫variables that we can just delete when we're done.
‫We're just going to use these to see how this exposure thing works so we can make some integers.
‫Let's make an INT 32 and I'm going to call this int 32 visible anywhere int.
‫And just right here I'm going to initialize this to a value, say 12.
‫Now in order to expose this to the reflection system, we're going to need a new property macro.
‫Now, this is just a plain integer variable.
‫It's not a component like these, so it's not going to show up in the components tab.
‫Remember here in the blueprint, we have this components section and any components show up here, but
‫any regular variables, those are going to show up.
‫If we click on BP Pond, Tank Self, for example, this is where we see all the other variables that
‫are not components.
‫So back in vs code, let's decide how we're going to expose visible anywhere.
‫INT Well, I'm going to introduce you to some you property keywords.
‫These are options that can go into the parentheses for the U.
‫Property macro.
‫For this one, we're going to add visible anywhere.
‫Now let's go ahead and compile this.
‫Okay.
‫So we've compiled let's jump back into the editor.
‫And here in BP Pond Tank, I have the BP pond tank self-selected here and I can search in the details
‫panel for visible and here is my visible anywhere int notice the blueprint places spaces in between
‫each of the words thanks to the way we've named this with Camel Case and check this out we can see that
‫it has a value of 12 and it's grayed out.
‫We can't actually edit this at all.
‫So that's what visible anywhere means.
‫It means it's visible, but we cannot edit this property.
‫Okay, so let's go ahead and create another INT 32.
‫I'm going to call this one edit anywhere int.
‫And for this I'll just give it a value, say 22 and this one will get its own U property macro and instead
‫of visible anywhere, I'm going to give this one the keyword.
‫Edit Anywhere.
‫Let's go ahead and compile this and back here in the editor I'm going to search instead for edit anywhere
‫and here is my edit anywhere and and you can see it has the value 22 only it's not grayed out anymore.
‫I can select it, I can change it.
‫It's editable.
‫That's what edit anywhere means.
‫It means we can change it.
‫So even though we're initializing it to 22 in C++, we can overwrite that value here in the blueprint
‫and give it a new value.
‫So now you've learned about Visible anywhere and edit anywhere, but there are more keywords than these
‫two.
‫For example, let's create a new int 32 and call this one visible instance only int and initialize this
‫to 11.
‫Now it's going to get its you property macro and the keyword I'll give to this one is visible instance
‫only.
‫Let's compile this and back here in the details panel in the blueprint I'm going to search for visible
‫now notice we can see visible anywhere int but where is our new variable?
‫We called it visible instance only.
‫INT See visible instance only.
‫INT Well, we can't see it here, but check this out.
‫I'm going to take our BP pond tank and drag one of these out into the world here.
‫And we can see in the world out liners.
‫Suddenly we have a BP pond tank here in the world.
‫Now, with this selected, I can come down here into the details panel and search for visible now check
‫this out now we can see our visible anywhere int and our visible instance only int.
‫So how can we can see it here, but we cannot see it when we're looking at the actual blueprint itself.
‫Well, there's a distinction I want to make.
‫You see, when we have our blueprint here in the content browser, we can double click it, we can open
‫it up and see its properties.
‫What?
‫We're looking at here is the default blueprint.
‫This contains all of the default information for the blueprint.
‫But as soon as I drag one out into the level, we now have something called an instance.
‫So this particular BP -- tank that exists in the world is an instance of BP pond tank.
‫In fact, we can drag out multiple instances and each of these that exist in the world are instances
‫of BP pond tank.
‫This is different than the default blueprint.
‫So here's a little graph for you to refer to, and we're going to be filling this graph out more as
‫we learn more specifiers.
‫So far we've only seen visible anywhere, which you'll see is under both the defaults and the instance
‫columns.
‫And it's in the row titled Read Only.
‫So you can see from this graph that a visible anywhere you property will only be visible.
‫It won't be editable, but it will be visible on both defaults and the instance.
‫Whereas visible instance only has read only access but only on the instance.
‫You can't actually see it on the default blueprint.
‫And then we learned about edit anywhere which allows us to actually edit that you property on defaults
‫and the instance.
‫So that's why it exists in both the defaults and the instance column.
‫So as a challenge, I would like you to add a variable to the base pond class.
‫Now put this in the public section and what you're going to do is decide what type of variable you'd
‫like to add, and it can be anything but make it a basic type, like an integer or a float.
‫You could even make it an F vector or an F string if you want to just initialize it with a default value
‫like our other end 30 twos.
‫And this could be any variable you want.
‫You can make a speed variable or a stamina variable.
‫You've got some freedom here.
‫Now once you've created this variable, decide which access level you want for this and then give it
‫a you property macro and add the correct specify here.
‫Now decide whether you want this to be visible only on the instance or on the defaults, or if you want
‫it to be visible anywhere or edit anywhere, use one of the specifiers we've learned so far and give
‫this variable the correct specify to go ahead and pause the video and make this variable now.
‫All right.
‫So I'm going to go ahead and make a variable.
‫Now, it's okay if you made something completely different.
‫This is just for practice.
‫I'm going to make a float and I'm going to call this speed and I'll initialize speed to say 400 F.
‫And I think I'd like this speed variable to be editable both on the instance and on the default.
‫So I'm going to give this a U property macro and make this edit anywhere.
‫So I'm going to go ahead and compile this.
‫And back in the editor, I can select one of my base -- tank instances.
‫And here in the details panel, I can see my speed variable and I can of course edit it here.
‫And if I open -- tank, here's my speed variable, it's set to 400 and it's editable.
‫So in summary, we've learned the difference between an instance versus the default of a particular
‫blueprint class.
‫We also learned a few new property specifiers, such as Visible Anywhere, Visible, instance only and
‫edit anywhere.
‫In the next video, we'll continue learning how to control access to C++ variables in Blueprint using
‫these new properties specifiers.
‫I'll see you soon.