How to Cast an actor from another actor

If I use direct reference method, I can access an int number but its giving error and if I setup a simple function that ascends 100 cm height, I cannot do it.

This is my first actor There is only a cube inside there is nothing more

And this is my second cube. I direct referenced FirstActor. and only wanted to set new location like my question and your answer.

When I hit play I cannot see the function is worked and I get this error

The solution is very important to me. I would be very happy if you solve my problem. Because of this, I cannot advance in my own project and I feel something is very easy and I am missing that piece

Please explain how those 2 actors get into the game:

  • did you place them in the level - scene
  • do you spawn them from class (if so which blueprint does it)

They are in scene just that. I didn’t spawn and I didn’t used level blueprint.

In the blueprint that needs to talk the other blueprint create a reference of the type of the other blueprint.

Above, this actor will try to talk to the aMover. Below, you can now choose an instance from the scene this instance will talk to:

Or use the pipette EYE DROPPER to select it directly. There would be no need to cast.

You now have a direct reference.

If in doubt, head over here:

And start reading up from this point:

Same thing as I suggested but explained better, in more detail.

If I use direct reference method, I can access an int number but its giving error and if I setup a simple function that ascends 100 cm height, I cannot do it.

This is my first actor There is only a cube inside there is nothing more

And this is my second cube. I direct referenced FirstActor. and only wanted to set new location like my question and your answer.

When I hit play I cannot see the function is worked and I get this error

The solution is very important to me. I would be very happy if you solve my problem. Because of this, I cannot advance in my own project and I feel something is very easy and I am missing that piece

Follow the steps I described. Show us how you assign the reference from the scene - 2nd pic in my example.

It seems you did not do it, hence the Accessed None error.

Hey, I am very happy to say it works. From now on, I won’t use level blueprint or character blueprint for such these small details. Thank you.

1 Like

Technically it’s not a bad idea to glue actors together using the LB and dispatchers. Have a look at his example:

image

In this thread:


Sometimes you may want actors to talk without them knowing about one another. Avoiding direct hard references can be beneficial. Imagine what happens if one of the actors gets destroyed, for example - the editor will throw errors at you again.

Using the above method would avoid that.