UnrealOni/Visual scripting: Difference between revisions

From OniGalore
Jump to navigation Jump to search
mNo edit summary
m (how to repair interface message)
Line 1: Line 1:
[[Category:Oni 2]]
=General information=
=General information=
==Some suggestions==
==Some suggestions==
Line 69: Line 70:
=Nodes=
=Nodes=
==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.

Revision as of 09:29, 16 March 2018

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

Nodes

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.