UnrealOni/Visual scripting: Difference between revisions
Paradox-01 (talk | contribs) (Created page with "==Some suggestions== Backup your project every day you work on it. Use hotkeys. * Make comments with [C]. Make a "color convention": categorize your comments with different...") |
m (/cat, header fixes (top-level headers are reserved for the page title)) |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
==Some suggestions== | ==General information== | ||
===Some suggestions=== | |||
Every day you work on your project, backup your project before you start working on it. | |||
Use hotkeys. | Use hotkeys. | ||
Line 11: | Line 11: | ||
Move a comment around to move its content. | Move a comment around to move its content. | ||
The Branch node is also accessible by typing | The Branch node is also accessible by typing '''''if'''''. | ||
Disable "Context Sensitive" if your really need to see all possible nodes. | Disable "Context Sensitive" if your really need to see all possible nodes. | ||
Line 17: | Line 17: | ||
Try to break down your code into reusable functions and macros. | Try to break down your code into reusable functions and macros. | ||
Make yourself familiar '''"interfaces"''', making '''"references"''', '''"casting"''' and try to think of your '''own component''' and making '''master blueprints'''. | Make yourself familiar with '''"interfaces"''', making '''"references"''', '''"casting"''' and try to think of your '''own component''' and making '''master blueprints'''. | ||
Learn what the different object classes (blueprints) do. Keep exploring, do experiments to know what is possible. It will make you more flexible. | Learn what the different object classes (blueprints) do. Keep exploring, do experiments to know what is possible. It will make you more flexible. | ||
Line 24: | Line 24: | ||
==Casting== | ===Casting=== | ||
With "cast to ..." nodes you access other blueprints, therefore their variables. | With "cast to ..." nodes you access other blueprints, therefore their variables. | ||
==References== | ===References=== | ||
After a casting it is often useful to make a reference so you don't need to make another casting at a later time. | After a casting it is often useful to make a reference so you don't need to make another casting at a later time. | ||
Line 34: | Line 34: | ||
'''Get a reference of any embedded component by dragging it into the event graph.''' | '''Get a reference of any embedded component by dragging it into the event graph.''' | ||
===Components=== | ====Components==== | ||
To access components you must have the parent object. That's easy if you are already in the right BP. If not you must first access the other blueprint with a cast or an already made reference. | To access components you must have the parent object. That's easy if you are already in the right BP. If not you must first access the other blueprint with a cast or an already made reference. | ||
Line 49: | Line 49: | ||
(Improve this section later by making two. One for components in the same BP and one for components of another BP.) | (Improve this section later by making two. One for components in the same BP and one for components of another BP.) | ||
====Characters==== | ====Characters===== | ||
Also characters are objects in the perspective of programming. In Blueprints you can access them following this hierarchy. | Also characters are objects in the perspective of programming. In Blueprints you can access them following this hierarchy. | ||
Character | Character(self) | ||
| | | | ||
+--- Capsule component | +--- Capsule component | ||
Line 63: | Line 63: | ||
For example use "Get Anim Instance" on the Mesh component. If you use a "cast to ..." on that characters anim instance you could now access the variables and functions inside the anim instance. | For example use "Get Anim Instance" on the Mesh component. If you use a "cast to ..." on that characters anim instance you could now access the variables and functions inside the anim instance. | ||
Any component listed under the "'' | Any component listed under the "''Character''(self)" can be referenced without making a detour. Just drag it into the event graph. | ||
===Interfaces=== | |||
==Good to know== | |||
===Repair nodes after moved content=== | |||
[[Image:UE4_repair_interface_message.png|thumb]] | |||
Renaming folder and moving blueprints around can destroy events. You can repair interface events by doing this: | |||
# Add the interfaces back to the blueprint. | |||
# Hit compile one time. | |||
# If available go on by pulling out the pin from a reference. | |||
# Add back events and messages. | |||
==Nodes== | |||
[[Category:Modding tutorials]] |
Latest revision as of 20:42, 23 June 2020
General information
Some suggestions
Every day you work on your project, backup your project before you start working on it.
Use hotkeys.
- Make comments with [C]. Make a "color convention": categorize your comments with different colors based on what they do or how much completed the code inside is.
- [F7] to compile.
- [Control]+[S] to save.
- [Control]+[P] to play.
Move a comment around to move its content.
The Branch node is also accessible by typing if.
Disable "Context Sensitive" if your really need to see all possible nodes.
Try to break down your code into reusable functions and macros.
Make yourself familiar with "interfaces", making "references", "casting" and try to think of your own component and making master blueprints.
Learn what the different object classes (blueprints) do. Keep exploring, do experiments to know what is possible. It will make you more flexible.
Use "Print" node to know what your code is currently doing !
Casting
With "cast to ..." nodes you access other blueprints, therefore their variables.
References
After a casting it is often useful to make a reference so you don't need to make another casting at a later time.
You simply store the made cast into a variable.
Get a reference of any embedded component by dragging it into the event graph.
Components
To access components you must have the parent object. That's easy if you are already in the right BP. If not you must first access the other blueprint with a cast or an already made reference.
In the easy case - or after the cast...
- Draw out the object pin and get the component by adding the "Get Component by Class" node.
- If the object has multiple components of the same class you use the "Get Components by Class" node to get them all as an array.
- To avoid complicated checks you might want to tag certain components. Then you can use the "Get Component by Tag" node.
Anyway, remember to create a reference to the component if it is suitable.
(Improve this section later by making two. One for components in the same BP and one for components of another BP.)
Characters=
Also characters are objects in the perspective of programming. In Blueprints you can access them following this hierarchy.
Character(self) | +--- Capsule component +--- Character Movement +--- Mesh (Skeletal Mesh) | +--- Anim Instance +--- Materials
For example use "Get Anim Instance" on the Mesh component. If you use a "cast to ..." on that characters anim instance you could now access the variables and functions inside the anim instance.
Any component listed under the "Character(self)" can be referenced without making a detour. Just drag it into the event graph.
Interfaces
Good to know
Repair nodes after moved content
Renaming folder and moving blueprints around can destroy events. You can repair interface events by doing this:
- Add the interfaces back to the blueprint.
- Hit compile one time.
- If available go on by pulling out the pin from a reference.
- Add back events and messages.