﻿1
00:00:04,770 --> 00:00:06,070
‫Hey, welcome back.

2
00:00:06,090 --> 00:00:11,850
‫In this video, we're going to make the distinction between instances of a particular blueprint class

3
00:00:11,850 --> 00:00:17,130
‫versus the default blueprint, which is the blueprint that applies to all instances.

4
00:00:17,130 --> 00:00:25,050
‫We're also going to see how we can assign, read or write access for a particular C++ variable in blueprints.

5
00:00:25,050 --> 00:00:26,360
‫So let's get started.

6
00:00:26,370 --> 00:00:30,810
‫We're now ready to start exposing some of our components to Blueprint.

7
00:00:30,930 --> 00:00:36,810
‫So here we have our components and we've seen that if we click on each one of them, our details panel

8
00:00:36,810 --> 00:00:38,040
‫is completely empty.

9
00:00:38,040 --> 00:00:44,070
‫So we need to learn how we can expose certain properties to blueprint, and we do that by the use of

10
00:00:44,070 --> 00:00:45,960
‫our U property macro.

11
00:00:45,960 --> 00:00:51,060
‫So let's jump back into VS code and take a look at the You property macro.

12
00:00:51,090 --> 00:00:53,010
‫This is a special macro.

13
00:00:53,010 --> 00:00:59,730
‫It's unique to Unreal Engine and it's got this set of parentheses because it can take input parameters

14
00:00:59,730 --> 00:01:06,390
‫now in order to show how to expose things in certain ways, we're just going to create a couple of throwaway

15
00:01:06,390 --> 00:01:09,870
‫variables that we can just delete when we're done.

16
00:01:09,870 --> 00:01:15,450
‫We're just going to use these to see how this exposure thing works so we can make some integers.

17
00:01:15,450 --> 00:01:21,600
‫Let's make an INT 32 and I'm going to call this int 32 visible anywhere int.

18
00:01:21,600 --> 00:01:27,090
‫And just right here I'm going to initialize this to a value, say 12.

19
00:01:27,090 --> 00:01:33,390
‫Now in order to expose this to the reflection system, we're going to need a new property macro.

20
00:01:33,390 --> 00:01:36,480
‫Now, this is just a plain integer variable.

21
00:01:36,660 --> 00:01:41,880
‫It's not a component like these, so it's not going to show up in the components tab.

22
00:01:41,910 --> 00:01:48,600
‫Remember here in the blueprint, we have this components section and any components show up here, but

23
00:01:48,600 --> 00:01:51,630
‫any regular variables, those are going to show up.

24
00:01:51,630 --> 00:01:58,590
‫If we click on BP Pond, Tank Self, for example, this is where we see all the other variables that

25
00:01:58,590 --> 00:02:00,120
‫are not components.

26
00:02:00,120 --> 00:02:05,250
‫So back in vs code, let's decide how we're going to expose visible anywhere.

27
00:02:05,250 --> 00:02:09,600
‫INT Well, I'm going to introduce you to some you property keywords.

28
00:02:09,600 --> 00:02:13,090
‫These are options that can go into the parentheses for the U.

29
00:02:13,110 --> 00:02:14,280
‫Property macro.

30
00:02:14,490 --> 00:02:17,400
‫For this one, we're going to add visible anywhere.

31
00:02:17,430 --> 00:02:19,860
‫Now let's go ahead and compile this.

32
00:02:20,100 --> 00:02:20,520
‫Okay.

33
00:02:20,520 --> 00:02:23,250
‫So we've compiled let's jump back into the editor.

34
00:02:23,250 --> 00:02:30,780
‫And here in BP Pond Tank, I have the BP pond tank self-selected here and I can search in the details

35
00:02:30,780 --> 00:02:38,340
‫panel for visible and here is my visible anywhere int notice the blueprint places spaces in between

36
00:02:38,340 --> 00:02:44,160
‫each of the words thanks to the way we've named this with Camel Case and check this out we can see that

37
00:02:44,160 --> 00:02:46,350
‫it has a value of 12 and it's grayed out.

38
00:02:46,350 --> 00:02:48,960
‫We can't actually edit this at all.

39
00:02:48,960 --> 00:02:50,580
‫So that's what visible anywhere means.

40
00:02:50,580 --> 00:02:54,270
‫It means it's visible, but we cannot edit this property.

41
00:02:54,300 --> 00:02:57,540
‫Okay, so let's go ahead and create another INT 32.

42
00:02:57,540 --> 00:03:00,960
‫I'm going to call this one edit anywhere int.

43
00:03:01,260 --> 00:03:10,230
‫And for this I'll just give it a value, say 22 and this one will get its own U property macro and instead

44
00:03:10,230 --> 00:03:13,770
‫of visible anywhere, I'm going to give this one the keyword.

45
00:03:13,770 --> 00:03:15,210
‫Edit Anywhere.

46
00:03:15,300 --> 00:03:21,690
‫Let's go ahead and compile this and back here in the editor I'm going to search instead for edit anywhere

47
00:03:21,690 --> 00:03:28,080
‫and here is my edit anywhere and and you can see it has the value 22 only it's not grayed out anymore.

48
00:03:28,080 --> 00:03:30,060
‫I can select it, I can change it.

49
00:03:30,060 --> 00:03:31,320
‫It's editable.

50
00:03:31,320 --> 00:03:32,970
‫That's what edit anywhere means.

51
00:03:32,970 --> 00:03:34,560
‫It means we can change it.

52
00:03:34,590 --> 00:03:40,950
‫So even though we're initializing it to 22 in C++, we can overwrite that value here in the blueprint

53
00:03:40,950 --> 00:03:42,600
‫and give it a new value.

54
00:03:42,600 --> 00:03:48,300
‫So now you've learned about Visible anywhere and edit anywhere, but there are more keywords than these

55
00:03:48,300 --> 00:03:48,780
‫two.

56
00:03:48,780 --> 00:03:57,450
‫For example, let's create a new int 32 and call this one visible instance only int and initialize this

57
00:03:57,450 --> 00:03:58,350
‫to 11.

58
00:03:58,350 --> 00:04:05,100
‫Now it's going to get its you property macro and the keyword I'll give to this one is visible instance

59
00:04:05,100 --> 00:04:05,940
‫only.

60
00:04:05,940 --> 00:04:12,630
‫Let's compile this and back here in the details panel in the blueprint I'm going to search for visible

61
00:04:12,630 --> 00:04:17,340
‫now notice we can see visible anywhere int but where is our new variable?

62
00:04:17,340 --> 00:04:19,440
‫We called it visible instance only.

63
00:04:19,440 --> 00:04:21,960
‫INT See visible instance only.

64
00:04:21,960 --> 00:04:24,720
‫INT Well, we can't see it here, but check this out.

65
00:04:24,720 --> 00:04:29,730
‫I'm going to take our BP pond tank and drag one of these out into the world here.

66
00:04:29,730 --> 00:04:31,560
‫And we can see in the world out liners.

67
00:04:31,560 --> 00:04:35,370
‫Suddenly we have a BP pond tank here in the world.

68
00:04:35,370 --> 00:04:42,300
‫Now, with this selected, I can come down here into the details panel and search for visible now check

69
00:04:42,300 --> 00:04:48,810
‫this out now we can see our visible anywhere int and our visible instance only int.

70
00:04:48,810 --> 00:04:54,750
‫So how can we can see it here, but we cannot see it when we're looking at the actual blueprint itself.

71
00:04:54,750 --> 00:04:56,790
‫Well, there's a distinction I want to make.

72
00:04:56,790 --> 00:05:01,770
‫You see, when we have our blueprint here in the content browser, we can double click it, we can open

73
00:05:01,770 --> 00:05:03,750
‫it up and see its properties.

74
00:05:03,750 --> 00:05:04,020
‫What?

75
00:05:04,090 --> 00:05:07,150
‫We're looking at here is the default blueprint.

76
00:05:07,150 --> 00:05:11,140
‫This contains all of the default information for the blueprint.

77
00:05:11,140 --> 00:05:16,360
‫But as soon as I drag one out into the level, we now have something called an instance.

78
00:05:16,360 --> 00:05:23,530
‫So this particular BP -- tank that exists in the world is an instance of BP pond tank.

79
00:05:23,530 --> 00:05:30,010
‫In fact, we can drag out multiple instances and each of these that exist in the world are instances

80
00:05:30,010 --> 00:05:31,510
‫of BP pond tank.

81
00:05:31,510 --> 00:05:34,840
‫This is different than the default blueprint.

82
00:05:35,080 --> 00:05:40,810
‫So here's a little graph for you to refer to, and we're going to be filling this graph out more as

83
00:05:40,810 --> 00:05:42,520
‫we learn more specifiers.

84
00:05:42,520 --> 00:05:48,640
‫So far we've only seen visible anywhere, which you'll see is under both the defaults and the instance

85
00:05:48,640 --> 00:05:49,420
‫columns.

86
00:05:49,540 --> 00:05:52,120
‫And it's in the row titled Read Only.

87
00:05:52,120 --> 00:05:57,640
‫So you can see from this graph that a visible anywhere you property will only be visible.

88
00:05:57,640 --> 00:06:02,260
‫It won't be editable, but it will be visible on both defaults and the instance.

89
00:06:02,260 --> 00:06:07,510
‫Whereas visible instance only has read only access but only on the instance.

90
00:06:07,510 --> 00:06:10,540
‫You can't actually see it on the default blueprint.

91
00:06:10,540 --> 00:06:16,420
‫And then we learned about edit anywhere which allows us to actually edit that you property on defaults

92
00:06:16,420 --> 00:06:17,530
‫and the instance.

93
00:06:17,530 --> 00:06:21,730
‫So that's why it exists in both the defaults and the instance column.

94
00:06:21,730 --> 00:06:27,010
‫So as a challenge, I would like you to add a variable to the base pond class.

95
00:06:27,010 --> 00:06:32,920
‫Now put this in the public section and what you're going to do is decide what type of variable you'd

96
00:06:32,920 --> 00:06:38,020
‫like to add, and it can be anything but make it a basic type, like an integer or a float.

97
00:06:38,170 --> 00:06:44,740
‫You could even make it an F vector or an F string if you want to just initialize it with a default value

98
00:06:44,740 --> 00:06:46,540
‫like our other end 30 twos.

99
00:06:46,810 --> 00:06:49,030
‫And this could be any variable you want.

100
00:06:49,030 --> 00:06:52,990
‫You can make a speed variable or a stamina variable.

101
00:06:52,990 --> 00:06:54,370
‫You've got some freedom here.

102
00:06:54,370 --> 00:07:00,820
‫Now once you've created this variable, decide which access level you want for this and then give it

103
00:07:00,820 --> 00:07:04,440
‫a you property macro and add the correct specify here.

104
00:07:04,450 --> 00:07:10,210
‫Now decide whether you want this to be visible only on the instance or on the defaults, or if you want

105
00:07:10,210 --> 00:07:16,210
‫it to be visible anywhere or edit anywhere, use one of the specifiers we've learned so far and give

106
00:07:16,210 --> 00:07:21,160
‫this variable the correct specify to go ahead and pause the video and make this variable now.

107
00:07:23,970 --> 00:07:24,690
‫All right.

108
00:07:24,690 --> 00:07:26,800
‫So I'm going to go ahead and make a variable.

109
00:07:26,820 --> 00:07:29,250
‫Now, it's okay if you made something completely different.

110
00:07:29,250 --> 00:07:30,810
‫This is just for practice.

111
00:07:30,810 --> 00:07:38,100
‫I'm going to make a float and I'm going to call this speed and I'll initialize speed to say 400 F.

112
00:07:38,700 --> 00:07:45,930
‫And I think I'd like this speed variable to be editable both on the instance and on the default.

113
00:07:45,930 --> 00:07:52,050
‫So I'm going to give this a U property macro and make this edit anywhere.

114
00:07:52,050 --> 00:07:54,360
‫So I'm going to go ahead and compile this.

115
00:07:54,360 --> 00:08:00,180
‫And back in the editor, I can select one of my base -- tank instances.

116
00:08:00,330 --> 00:08:06,870
‫And here in the details panel, I can see my speed variable and I can of course edit it here.

117
00:08:06,870 --> 00:08:13,290
‫And if I open -- tank, here's my speed variable, it's set to 400 and it's editable.

118
00:08:13,290 --> 00:08:19,140
‫So in summary, we've learned the difference between an instance versus the default of a particular

119
00:08:19,140 --> 00:08:20,220
‫blueprint class.

120
00:08:20,220 --> 00:08:26,280
‫We also learned a few new property specifiers, such as Visible Anywhere, Visible, instance only and

121
00:08:26,280 --> 00:08:27,240
‫edit anywhere.

122
00:08:27,240 --> 00:08:34,050
‫In the next video, we'll continue learning how to control access to C++ variables in Blueprint using

123
00:08:34,050 --> 00:08:35,880
‫these new properties specifiers.

124
00:08:35,970 --> 00:08:36,900
‫I'll see you soon.

