Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411502 Posts in 69379 Topics- by 58435 Members - Latest Member: graysonsolis

April 30, 2024, 04:35:46 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsC++ Variables for blueprint - Update 5 - Unreal C++ Tutorial Series Project
Pages: [1]
Print
Author Topic: C++ Variables for blueprint - Update 5 - Unreal C++ Tutorial Series Project  (Read 606 times)
enigma27
Level 0
***


View Profile
« on: June 17, 2023, 06:49:18 AM »

Update 5 How to write C++ variables for Unreal blueprint; UPROPERTY Basics



What's wrong with just putting EditAnywhere on everything? Here I explain the different mark up keywords for configuring UProperty variables for the editor.

The reason you don't want to use EditAnywhere on everything, is that you are relaxing your intention beyond usefulness and potentially into detrimental territory. There are times where you only want the defaults of an actor to be editable; you don't want all actors placed in the world to have that property modifiable independently. By restricting to EditDefaultsOnly you have more control over all actors in a level. IMO the default keyword you should use is EditDefaultsOnly, and then expand that to EditAnywhere on a case-by-case basis.

Here I start the discussion of the UPROPERTY features you can specify in code. In this first video I cover what might be the most used mark up for properties. We will further explore this in later videos.

0:00 Set up
0:15 Bare UProperties
0:27 Adding EditDefaultsOnly to make it appear in the editor
0:45 UProperty name display in editor
0:54 Changing code variables in Editor
1:04 EditInstanceOnly to modify actors in a level
2:00 EditAnywhere to modify defaults and instances in a level
2:30 Edit mark up doesn't give blueprint access
3:04 BlueprintReadOnly to allow blueprint scripts to read (get) the variable.
3:23 BlueprintReadWrite to allow blueprint scripts to get and set a variable.
3:50 BlueprintReadWrite variables don't allow defaults set
4:04 Mixing BlueprintReadWrite and EditAnywhere keywords to achieve maximum blueprint exposure.
4:40 Visible Keywords (VisibleDefaultsOnly, VisibleInstanceOnly, VisibleAnywhere)
5:37 Outro to part 1


Update 3:




A conversion guide from Blueprint to C++ and vice versa. Most every BP feature demonstrated in C++ code instead.

I wanted to create a broad and comprehensive overview of using C++ and BP in the unreal engine. I'll explore these topics in much more depth in later videos. But this video should be enough for someone familiar with Blueprint concepts to see how those concepts translate to blueprint. It also serves as a guide for someone familiar with C++ to see how concepts translate into BP script that  a design unfamiliar with C++ might use their code.



Hey Everyone, I decided to make some Tutorials on Unreal C++ from what I have learned in the industry. Making these tutorials is my current project, rather than a game project. This seems like an appropriate place to post updates.

First video is my IDE set up at work (I work for a AAA studio now using Unreal 5).
People have different set ups, but here's mine and it works pretty well for me:



 
« Last Edit: April 13, 2024, 05:54:02 AM by enigma27 » Logged

I like to make tutorials and devblogs. youtube: https://www.youtube.com/channel/UC9CQOdT1A9JlAks0-PF5vvw
moller trumbore ray triangle intersection:
https://youtu.be/fK1RPmF_zjQ?list=PL22CMuqloY0pRNhvBXowdpMtEin8-RFtb
enigma27
Level 0
***


View Profile
« Reply #1 on: July 01, 2023, 09:24:26 AM »

How to make a new C++ actor and use it in blueprint!
Some Dos-and-Don'ts of creating Unreal C++ classes that can be used in the editor and blueprint.
Basic Unreal Header Tool Introduction and how to properly mark up your classes to be used with the Engine.

Unfortunately this video was recorded in 720p, later videos will be recorded at a higher resolution.





0:00 Intro
0:03 Designer's Work Flow For Blueprint
0:18 Creating a C++ Actor Class
0:28 The Wrong Way to Add New Classes
1:00 The Reliable Way To Add New Classes
1:28 Regeneration Project Files
1:48 Setting up the Header File
1:51 UCLASS Explanation
3:28 Begin Play In Code
4:05 Reparenting Blueprint To Your Code Class (ie have blueprint subclass your code)
4:27 Debugging Your C++ Code
4:49 Using the Editor To Create Classes
5:06 DLL Export Macro
5:21 Outro

Amendment to show how to add files in visual studio, though I still recommend just making them in windows file explorer.

Logged

I like to make tutorials and devblogs. youtube: https://www.youtube.com/channel/UC9CQOdT1A9JlAks0-PF5vvw
moller trumbore ray triangle intersection:
https://youtu.be/fK1RPmF_zjQ?list=PL22CMuqloY0pRNhvBXowdpMtEin8-RFtb
enigma27
Level 0
***


View Profile
« Reply #2 on: July 22, 2023, 05:16:15 AM »

 Wizard

A conversion guide from Blueprint to C++ and vice versa. Most every BP feature demonstrated in C++ code instead.

I wanted to create a broad and comprehensive overview of using C++ and BP in the unreal engine. I'll explore these topics in much more depth in later videos. But this video should be enough for someone familiar with Blueprint concepts to see how those concepts translate to blueprint. It also serves as a guide for someone familiar with C++ to see how concepts translate into BP script that  a design unfamiliar with C++ might use their code.




Logged

I like to make tutorials and devblogs. youtube: https://www.youtube.com/channel/UC9CQOdT1A9JlAks0-PF5vvw
moller trumbore ray triangle intersection:
https://youtu.be/fK1RPmF_zjQ?list=PL22CMuqloY0pRNhvBXowdpMtEin8-RFtb
enigma27
Level 0
***


View Profile
« Reply #3 on: March 23, 2024, 05:24:24 AM »

Update 4:





This is perhaps the most common way someone learning to write C++ in Unreal accidentally crashes the game.

Without safe mark up, you can create a ticking time bomb for a crash. C++ can be dangerous if not careful. Blueprint ensures this type of situation isn't possible, but with C++ it is on you to ensure your safely accessing and protecting your memory. By putting the macro UPROPERTY() above your variables to unreal types, the GC becomes aware of the pointer and will manage it. But without it, you create a situation where the GC will free the object, but be unaware to update the pointer to nullptr. Meaning you will have a dangling pointer. At best this null pointer will crash the game. At worst, it will corrupt memory and the game will keep on running with invalid memory. Wrecking incomprehensible and inconsistent issues on the game with undefined behavior.
Logged

I like to make tutorials and devblogs. youtube: https://www.youtube.com/channel/UC9CQOdT1A9JlAks0-PF5vvw
moller trumbore ray triangle intersection:
https://youtu.be/fK1RPmF_zjQ?list=PL22CMuqloY0pRNhvBXowdpMtEin8-RFtb
enigma27
Level 0
***


View Profile
« Reply #4 on: April 13, 2024, 05:54:33 AM »

Update 5 How to write C++ variables for Unreal blueprint; UPROPERTY Basics



What's wrong with just putting EditAnywhere on everything? Here I explain the different mark up keywords for configuring UProperty variables for the editor.

The reason you don't want to use EditAnywhere on everything, is that you are relaxing your intention beyond usefulness and potentially into detrimental territory. There are times where you only want the defaults of an actor to be editable; you don't want all actors placed in the world to have that property modifiable independently. By restricting to EditDefaultsOnly you have more control over all actors in a level. IMO the default keyword you should use is EditDefaultsOnly, and then expand that to EditAnywhere on a case-by-case basis.

Here I start the discussion of the UPROPERTY features you can specify in code. In this first video I cover what might be the most used mark up for properties. We will further explore this in later videos.

0:00 Set up
0:15 Bare UProperties
0:27 Adding EditDefaultsOnly to make it appear in the editor
0:45 UProperty name display in editor
0:54 Changing code variables in Editor
1:04 EditInstanceOnly to modify actors in a level
2:00 EditAnywhere to modify defaults and instances in a level
2:30 Edit mark up doesn't give blueprint access
3:04 BlueprintReadOnly to allow blueprint scripts to read (get) the variable.
3:23 BlueprintReadWrite to allow blueprint scripts to get and set a variable.
3:50 BlueprintReadWrite variables don't allow defaults set
4:04 Mixing BlueprintReadWrite and EditAnywhere keywords to achieve maximum blueprint exposure.
4:40 Visible Keywords (VisibleDefaultsOnly, VisibleInstanceOnly, VisibleAnywhere)
5:37 Outro to part 1
Logged

I like to make tutorials and devblogs. youtube: https://www.youtube.com/channel/UC9CQOdT1A9JlAks0-PF5vvw
moller trumbore ray triangle intersection:
https://youtu.be/fK1RPmF_zjQ?list=PL22CMuqloY0pRNhvBXowdpMtEin8-RFtb
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic