How to make a public function inside of the gameObject and then call it from the outside in Bolt?

nnbveh 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 1

Hi. Just watching some basic tutorials on coding in unity and planning g to recreate them in bolt. In one of them author creates a cube with the script attached to it. In that script he defines a public function which sets a rotating speed of that cube around the center of the scene, and then another script(which is attached to an empty object) calls that function every time an instance of the cube is spawned so all the instances have different speeds. What is equivalent of public function in Bolt? Custom event? And if yes, how do I call it from the outside? Thanks!

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):
Satisfaction mark by nnbveh 2 years ago

Custom event is the equivalent indeed! You can use the Trigger Custom Event unit to call it from anywhere. Make sure to pass the target that is listening for it as the input parameter and the same name.

In the future, this will become simpler and clearer with custom event definitions.