Undo and Redo with the Command Pattern - C# and Unity

Undo and Redo with the Command Pattern - C# and Unity

One Wheel Studio

3 года назад

22,214 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@user-tn6sk4bl8w
@user-tn6sk4bl8w - 11.12.2023 09:14

pks make more design pattern tutorials.

Ответить
@scififan698
@scififan698 - 12.10.2023 20:12

This is pretty retarded. Normally, an undo-redo systems simply uses two stacks. One for undo, one for redo. What are you messing about for with that convoluted single list? 🙄😂😢

Ответить
@richardrothkugel8131
@richardrothkugel8131 - 12.05.2023 08:45

I've watched the observer pattern video dozens of times and have fully integrated the pattern into my own project. Although I understand not wanting to deviate from a 'pure' command pattern, I think it would be far more useful to show the command pattern together with the observer pattern. I won't have any trouble converting it over when I'm implementing it myself, but people new to observer might have trouble. Perhaps you could make a new video, something along the lines of 'Integrating observer and command patterns', which could cover this topic.

Ответить
@ricniclas
@ricniclas - 27.07.2022 22:16

I never though about using object pooling for the commands! what an intelligent idea

Ответить
@Renegen1
@Renegen1 - 21.05.2022 22:32

so well explained

Ответить
@markorossie9296
@markorossie9296 - 02.04.2022 11:12

I wanna see something about S.O.L.I.D, That would be interesting to see you cover this.

Ответить
@marcohuiberts1036
@marcohuiberts1036 - 29.03.2022 10:42

I think adding the undo command to the list is better done after execute. If execute fails, and you want to run the undo, the last one failed, and the undo will fail.

Ответить
@THEspindoctor84
@THEspindoctor84 - 17.02.2022 16:55

this channel is really awesome. Thanks for another great video!

Ответить
@zebgagang
@zebgagang - 08.02.2022 16:39

Good tutorial. I would like to mention, that I prefer to use Stack in such case. More flexible and code looks more elegant. Thx for sharing such great explanation of this pattern.

Ответить
@muhammetuymaz2961
@muhammetuymaz2961 - 26.01.2022 13:25

I guess, we can use two stacks for undo and redo

Ответить
@stvs9722
@stvs9722 - 11.01.2022 17:28

Why doesn't this guy have more subscribers? Goldmine, thanks

Ответить
@JulesCalella
@JulesCalella - 02.09.2021 06:59

I can see this being used in tutorials for any game, where you want to progress through particular moves and allow the player to go back to a previous step.

Would this be overkill for that or is this exactly what you'd use?

Ответить
@milhouse529
@milhouse529 - 19.04.2021 16:45

Love your style of teaching, you earned my sub, sir! You mentioned behaviour trees in the state pattern video and I'd be delighted if you made a video about that topic.

Ответить
@Iboshido
@Iboshido - 18.04.2021 12:10

such a nice and clean tutorial

Ответить
@dmytroskoropadskyi5792
@dmytroskoropadskyi5792 - 30.01.2021 23:35

Ty for your work! :)

Ответить
@chenrobinbunnyhugger2418
@chenrobinbunnyhugger2418 - 09.01.2021 18:46

Im still cant understand the difference between this one to memento undo redo

Ответить
@amilkarmassy
@amilkarmassy - 18.12.2020 23:25

thanks for sharing your knowledge! +1 sub, greetings from Bolivia

Ответить
@varan9412
@varan9412 - 27.11.2020 00:15

thanks, great video

Ответить
@MrZero000cool
@MrZero000cool - 23.11.2020 13:05

Hey, thank you for your tutorials. Do you think it would be possible to make a tutorial on aligning an moving object with uneven terrain, especially its rotation? For example if my cube goes up a slope it should rotate to match the slope angle. Its the rotation part to align it with the terrain that I don´t understand how to do in bolt. That would be such a great help and there are no other bolt tutorials that tackle that topic.

Ответить
@JasonStorey
@JasonStorey - 19.11.2020 18:41

great video, clear and well explained.

In general though I would personal favour a "stack" instead of a list as by design you can push and pop the commands onto the undo redo stacks and avoid having to maintain indexes etc. Also while I 100% agree on encapsulating a commandhandler/manager It is still ill advised to expose that implementation detail out of the character. If a character can undo/redo his movement it shouldn't matter how that happens, if it is delegating or not, so to avoid Law of Demeter violations I would keep the Undo/Redo calls on the Character and internally delegate them to my handler `public void Undo => commands.Undo() ` etc.

Ответить
@justinwhite2725
@justinwhite2725 - 19.11.2020 17:15

I would have created a new list for redos that got cleared if you enter a new command. Undo removes a command from the list and adds it to the redo list. Redoing removes it from the redo list and puts it back into the main command list.

Ответить
@OneWheelStudio
@OneWheelStudio - 16.11.2020 00:12

Is there another pattern you'd like to see covered? Which one?

Ответить