﻿1
00:00:04,160 --> 00:00:11,360
‫So one thing to be aware of with live coding is that at the moment you can encounter some bugs when

2
00:00:11,360 --> 00:00:12,080
‫using it.

3
00:00:12,080 --> 00:00:19,010
‫So for example, suppose I wanted to add a new new property in to my moving platform.

4
00:00:19,010 --> 00:00:22,070
‫I can go ahead and just copy the INT.

5
00:00:22,070 --> 00:00:24,950
‫I'm just going to have a my int two in here.

6
00:00:24,950 --> 00:00:32,600
‫Now I go ahead and faithfully according to the course use live coding to rebuild and see my new property.

7
00:00:32,600 --> 00:00:39,650
‫And once that's done, go ahead and close the window and I might go ahead and update the moving platforms.

8
00:00:39,650 --> 00:00:46,370
‫Property here might say, oh, I don't want it to be 99 here, I want it to be set to 300 instead.

9
00:00:46,370 --> 00:00:49,780
‫And then I finish up for the day and I close down my editor.

10
00:00:49,790 --> 00:00:56,030
‫However, what you may observe is that when you go ahead and relaunch the project and go to the outline

11
00:00:56,030 --> 00:00:59,420
‫and look again for your moving platform, select it.

12
00:00:59,570 --> 00:01:03,320
‫You'll see that, oh no, that new property has disappeared.

13
00:01:03,320 --> 00:01:10,790
‫So what appears to have happened is that live coding only affected the change in the editor, but it

14
00:01:10,790 --> 00:01:13,670
‫didn't make it permanent on disk.

15
00:01:13,670 --> 00:01:16,190
‫It didn't kind of make it stay there.

16
00:01:16,190 --> 00:01:20,000
‫So what you might be tempted to do is, okay, well, I'll just hit the live coding button again.

17
00:01:20,000 --> 00:01:26,000
‫It's going to go ahead and rebuild and it's going to reintroduce my change, but you'll notice, oops,

18
00:01:26,000 --> 00:01:28,160
‫it's reset it to the default value.

19
00:01:28,160 --> 00:01:31,790
‫So I've lost that data that I had entered in here, which is no good.

20
00:01:31,790 --> 00:01:37,910
‫So if you do find yourself in this situation where you've gone ahead and seem to have lost some data,

21
00:01:37,940 --> 00:01:44,540
‫go ahead and close the editor straight away so that we don't save any of that lost data.

22
00:01:44,930 --> 00:01:52,250
‫And then what you want to do is go over to Visual Studio code and control shift B to bring up the build

23
00:01:52,250 --> 00:01:56,210
‫tasks and start your regular build task here.

24
00:01:56,420 --> 00:02:01,010
‫Make sure it re compiles fully outside of the editor with the editor closed.

25
00:02:01,010 --> 00:02:08,030
‫Then you can go back to your project file and open it up again and we can go and look in the outline

26
00:02:08,270 --> 00:02:11,870
‫for our moving platform and select it.

27
00:02:11,870 --> 00:02:12,650
‫And they go.

28
00:02:12,650 --> 00:02:19,310
‫You can now see that the new property I'd added is not only there but it is also there with the value

29
00:02:19,310 --> 00:02:21,260
‫that we saved it as before.

30
00:02:21,260 --> 00:02:25,670
‫We close the editor for the first time so we've not lost any data this way.

31
00:02:25,670 --> 00:02:31,310
‫Now I find that 90% of the problems with live coding boils down to this issue.

32
00:02:31,310 --> 00:02:37,130
‫So if that's the case, then a restart of the editor and reloading can do the trick.

33
00:02:37,130 --> 00:02:43,520
‫But if you find that frustrating or you seem to be having other issues with live coding, you can revert

34
00:02:43,520 --> 00:02:46,490
‫to the old method of doing stuff which is called hot reloading.

35
00:02:46,490 --> 00:02:50,270
‫You go to the edit menu and go to the editor preferences.

36
00:02:50,270 --> 00:02:56,810
‫You select live coding under the general section and you just disable live coding like.

37
00:02:56,810 --> 00:03:04,040
‫So then you can close the preferences and you'll need to restart the editor to make this change permanent.

38
00:03:04,040 --> 00:03:11,570
‫So once that has been restarted, you can recompile either using the usual recompile button at the bottom,

39
00:03:11,570 --> 00:03:12,290
‫right?

40
00:03:12,290 --> 00:03:18,230
‫So hopefully this lecture will see you through any issues you may encounter compiling with live coding.

41
00:03:18,260 --> 00:03:19,970
‫And I'll see you in the next lecture.

