Use Bluepoint,How to new and delete?

If I need new int use to do something and delete it after used.
With out C++ can I do it?

What’s Bluepoint?

How to new and delete?

How to create and delete what?

If I need new int use to do something
and delete it before used.

It’s really hard to tell what you need. It sounds a bit like a local variable - these can be declared inside functions and go out of scope.

in c++,it like this:
int* NewInt(void)
{
int* i = new int;
return i;
}
void DeleteInt(int* i)
{
delete i;
}
but I want to use it in bluepoint.

this is spawn a object(like actor).but I need to spawn a variable.such as C++ new delete.like this 2 function.int* NewInt(void) { int* i = new int; return i; } void DeleteInt(int* i) { delete i; }

For example, if I need to play montage clips in sequence (such as multi-segment attacks). I set up an integer variable a, if the player clicks the button, A++, and wait for a while before returning to 0. But the problem is that every time a button is clicked, a script that waits and returns to 0 is triggered. But in fact, what I need is that if the player does not click at intervals, it will be zero. If the player keeps clicking, only the last click should trigger zero (not every click).

Then I need to create a new variable B every time the player clicks, which will exist for a certain time and then be deleted, and stored in the value of a when it was created. In this case, there should be many variables B in the role blueprint, and then only the last variable B equals A. Then I just need to judge A == B, and then trigger 0. It is used to achieve the result that only the last click can return the counter to 0. Then the number of variables B should be related to the player’s clicks, which can not be achieved by creating a new variable. So I think of the new delete in c++. Of course, if you make B into an actor class, just click to create an actor in the scene, and then wait for a period of time to destroy, it can also be achieved, but this will greatly increase resource consumption, not as simple as adding only 4 bytes (32 bits) to new int. C++ can be implemented, but the blueprint does not know how to do it.

When using blueprints there are two ways of creating and destroying things.

Objects - Basically everything that is not an actor (aka does not exists in 3D space:

. To create an object use the Construct Object of Class. Input the class you want to spawn an object from.
. To destroy an object set any reference to it to null and the object will get garbage collected.

Actors - AKA things that can be placed in the level:

. To create an actor simply use the Spawn Actor of Class node. Input the class and the trasnform of the actor to be used in the level.
. To Destroy an actor call on it the Destroy Actor node or the Set Life Span (which will destroy de actor after a set amount of time in seconds).

Value Types: Ints, Floats, Text, Strings, etc.
You do not need to create nor to delete these as they are value types. Its not needed nor in Blueprints nor in C++.

Here is a picture of all the nodes I’ve mentioned:

280219-bp-createdestroyobjects.png

If you are having issues creating variables in blueprints I recomend you taking a look at the documentation here: Blueprint Visual Scripting | Unreal Engine Documentation

You cannot create pointers to value types in Blueprints. Instead of spawning an actor to handle this you should create an object, which supports exactly what you want to do. Objects are almost empty and you will not notice any performance change when comparing it to a pointer to an int (which, by the way is not 4 bytes only, its 8 since 4 bytes are from the int and 4 from the pointer to the int which also needs memory alocation -8 if using a 64bit compiler-). While obviosly your original approach is more efficient I doubt you will spawn millions of objects to notice the impact in making your combo system work.

Also, why not simply doing it in C++ if it supports what you need?