How to get access to another script?

Hey folks!

Does someone know how to get access to another script, so i can (for example) edit the variables in another script? I tried to make it a public class, but it doesn’t work. UE4 scripting is almost completely different from other Engines i know ^^

Sincerely ! :slight_smile:

EDIT:
Ok, i think that’s a bit too little information. So here is my situation:

I have a key in my level that the player needs to pick up. So i made another script for this key and gave it a mesh, a sphere collider and a text component. Now I want, that the player can pick up the key, only if he overlaps with the sphere collider. Then he should press ‘E’ and pick up the key. ‘E’ is considered here as a general action button (open doors, pick up things, and so on).

So how would I achieve this the “Unreal Engine” way? The player + keys are written entirely in C++. No Blueprints were used.

Everything works fine, but i don’t understand how to handle this with the action key. I made a test in Blueprint and it worked, but i want this game to be more C++ :stuck_out_tongue:

If you need more information let me know please!

Thanks in advance!

bump

Still have this problem. Has really nobody an explanation?

The term “script” doesn’t have any meaning in the context you used it. Perhaps when you say “script” you mean “object of class derived from Actor”?

You might find this article linked by the @UnrealEngine Twitter account interesting: [Tutorial] UsableActor System in C++](Basic Interaction System in C++ - Tom Looman)

Quote from the introduction:

Hey and thanks for your answer!

Sorry about that. I come from Unity and here in Unreal much is almost completely different.

Thanks for the link! That’s indeed very helpful and will take me probably to the solution of my problem!