UnrealOni/Visual scripting: Difference between revisions

From OniGalore
Jump to navigation Jump to search
mNo edit summary
m (/cat, header fixes (top-level headers are reserved for the page title))
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=General information=
==General information==
==Some suggestions==
===Some suggestions===
Every day you work on your project, backup your project before you start working on it.
Every day you work on your project, backup your project before you start working on it.


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.


Line 65: Line 65:
Any component listed under the "''Character''(self)" can be referenced without making a detour. Just drag it into the event graph.
Any component listed under the "''Character''(self)" can be referenced without making a detour. Just drag it into the event graph.


==Interfaces==
===Interfaces===


=Nodes=
==Good to know==
==Repair nodes after moved content==
===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:
Renaming folder and moving blueprints around can destroy events. You can repair interface events by doing this:
# Add the interfaces back to the blueprint.
# Add the interfaces back to the blueprint.
# Hit compile one time.
# Hit compile one time.
# If available go on by pulling out the pin from a reference.
# Add back events and messages.
# 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

UE4 repair interface message.png

Renaming folder and moving blueprints around can destroy events. You can repair interface events by doing this:

  1. Add the interfaces back to the blueprint.
  2. Hit compile one time.
  3. If available go on by pulling out the pin from a reference.
  4. Add back events and messages.

Nodes