How get to another class

Hello. Im little confused. I made my house with C++ Class Lamp. I want to my FirstPersonCharacter BP with component CharacterInput script and delegate to action, called function in another C++ class with name Lamp. Anyone can you tell me, how can I make this? I cant move with it.

Hey there, can you explain better what you want? You have a house that has some lamps (the class was made in c++) and you want to be able to enable and disable the lights with an action button? Is that it?

What you mean is how to get object, class is only a matrix to create objects, definition of a object, you need to spawn actor or create object to actully make code execute inside that object. There manyways to get object of perticlar thing, but in case of actors there 4 most common ways:

-Level Blueprint, in level blueprint you can reference any actor on the level as level blueprint is part of it, just select any actor on level, and right click on level blueprint nad you can add node to get it. Note that level blueprint is intentended to only be used for level scripting and if you want to make reusable code on any level you should avoid using it it that case. Obviously this is only for blueprint.

-Get All Actors Of Class in blueprint (and C++ too) and TActorIterator. It a brute force solution by searching actor of specific class on the level. Obviously this is this is performance heavy operation.

You use TActorIterator like this:

for (TActorIterator<ALamp> ActorItr(()); ActorItr; ++ActorItr) {
      //here code for each lamp found, you can use "break" to stop loop when you did what you needed
}

-Make a this kind of property:

UPROPERTY(EditAnywhere)
ALamp* Lamp

Or varable in blueprint and set category for it. Then when you palce actor with that property you can set object in detail tab when you select it, this allows to effectively link actors together, it very nice way to make actors reusable.

-Now 4th one is one that you may look for, search for actor via collision system using Sweeps and Line tracing:

https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/UseRaycasts/Blueprints/

When you set up lien trace you can get according reference of things you collide, it best way to check what on front of you