Download

One BP for many similar actors/etc. ?

In an older engine (and I am guessing any other engines with regular code) I can make a script/code that I can use on many similar objects. For example, once generalized script for doors/buttons/platforms. So all I’d need to do, once I have script working, is simply put it on any object that have similar functionality, and based on object’s parameters (in an older engine it would spawn arguments or spawnargs) script would determine whether it’s a button or door or platform or lift, and what/how it needs to work based on those parameters.

Is something like that possible with BP ?

If so, how would I add “spawnargs” (parameters) to actors and how would I attach same BP to several actors ?

Thanks.

This is at least how I’d do it:

Instead of attaching a script to the objects, create a base Blueprint class, such as BaseInteractableActor with an OnInteract function. Create a Blueprint class that derives from this for doors, one for lifts, etc. This also makes it easier because later if you want it to interact when E is pressed for example, you can see if a character is looking at an object, see if it is interactable (I.e. derives from the BaseInteractableActor class), and call its OnInteract function.

Attaching a script that can detect what the object is would be harder.

You can do this with “blueprint components”.

https://www.youtube.com/watch?v=qr4ZjieAQKY

Thanks, I’ll look into it.