Skip to main content
Version: Reality 4.27

Activating Fire During Runtime

Reality Editor has some differential features to binding on property changed functions. For example, we are able to activate/deactivate the particle systems depends on the change of the variable. To expose this change to the Reality Setup, we need to create a function named OnChanged_VariableName. VariableName should be the same name as the main variable name that will be changed.

This tutorial aims at three main topics:

  • Understanding to use OnChanged_ function.
  • Understanding the basic of blueprint events and emitter parameters.
  • Usability of actor ZD Actor component.

Getting Started

  • Click on ADD NEW and BLUEPRINT CLASS under Content Browser tab.

  • Click Actor.

  • Rename it as FireActor. Double Click to open. The event-graph will be appear. (You can also hit the F2 key to rename after selection.)

  • Click ADD NEW search for "Part" and click Particle System.

  • Click ADD COMPONENT search for "zd" and click ZD ACTOR

  • Click ADD COMPONENT search and find the STATIC MESH and click on it

  • The components tab will appear like this:

  • Click on ZD ACTOR and change Actor Name to FireActor on Reality tab details panel (Make sure that you changed the Actor Name on Reality tab.)

  • Click on Particle System on Components tab. In details panel, change template to P_Fire on Particles category. Uncheck Visible on Rendering category. (Note: You must include Starter Content to use P_Pire particle.)

  • Click on StaticMesh on Components tab. On the Details Panel, select static mesh as SM_Chair.

  • Under My Blueprint tab, Click ADD NEW and then VARIABLE. Subsequently, click on variable, on details panel change variable name to FireRate. Variable type is float. And check Instance Editable.

  • Under My Blueprint tab, Click ADD NEW and then FUNCTION. Rename as OnPropertyChanged_FireRate. Double click on the OnChanged_FireRate function.

IMPORTANT NOTE: You need to declare function name as OnPropertyChanged_VariableName format. Otherwise any property change will not be reflected.

  • Click on ParticleSystem under components, on the details panel Double Click on P_Fire. The emitter menu will be appear.
  • Click Spawn on Emitters tab.
  • Expand Rate on Details tab.
  • Select distribution as Distribution Float Particle Parameter.
  • Set parameter name rate.
  • Set Max Output to100.00
  • Set Constant to 0.5.

  • Back to OnPropertyChanged_FireRate function. Connect the nodes as shown in below. Do not forget to set Parameter Name as rate.

  • Click COMPILE and then SAVE on the top menu. Close the blueprint.

  • Drag your FireActor from Content Browser to the level. Launch Reality Setup. Afterward, click on the PLAY button.

  • Launch Reality Setup. FireActor will appear in the nodegraph. Click FireActor and middle click on FireRate. Change value to 50. And change it to 1. And investigate the screen. The spawn rate of fire will be changed in real-time.

Important Points

  • ZD Actor Component must be included.
  • The exposed variable name must be public (instance editable)
  • The exposed function name must follow this format: OnChanged_ExposedVariableName

Conclusion

In conclusion, we bind our variable into Reality Setup. We included ZD Actor to expose our actor object into the nodegraph. We added a new variable "FireRate" and make it instance editable. We defined new function as OnChanged_FireRate. We set up emitter parameter named as "rate" and therefore we changed our property on the nodegraph.