Download

Blueprints with c++?

I read somewhere you can click on the properties in blueprints to add C++ code? How do you do this?

As an example, if I wanted to do the equivalent of this (from Unity):


Start(){
int x=Random.Range(0,10);
int y=Random.Range(0,10);
Debug.Log( x+" + "+y+" = "+(x+y));
}

How can I do this with Blueprints without putting up loads of boxes. I don’t mind using blueprint boxes to get the random variables but I should just like to type in x+" + “+y+” = “+(x+y) purely in c++, is this possible?
Or in C++ this would be something like printf(”%d + %d =%d",x,y,x+y). Very simple.

Also, for more complicated formula I don’t want to hook up boxes. For example I should like to write: Mathf.sqrt(xx+yy+z*z) and other mathematical formulae without having to use boxes. Is this possible? i.e. to add small equations or scripts to blueprints?

No, there is no such feature.
If you don’t want to use boxes at all, stick with C++.

If you don’t mind some boxes, write often used functions and complicated code in C++, then expose them to the Blueprint system.

Alternatively, create those often used functions and complicated code with a Blueprint and put it into a macro library.

Your options have options.