"Accessed none trying to read TrashRef" How do I reference an actor's mesh? + I couldnt do it Casting either..

I am making a trash collecting game and I made it so that there’s an item next to the camera that when you pick up an item it becomes visible with the same mesh as the item you picked up. There is a can mesh and a paper mesh. I did it with another method but it doesnt work with my improved code since it uses Casting and looping with an array element.

1 Like

TrashRef needs to get set, when is that happening?

2 Likes

It’s a reference to an actor but it’s not identifying it. Then “Interactmesh” is the mesh Im refering to. What do you mean by when is that happening? I wanted to make that when you pickup the object the mesh in front of the camrea gets set. I managed to do that correctly, the only problem is that it doesnt idetnify the mesh.

1 Like

It’s no good just being of the right type, it actually has to be assigned :slight_smile:

1 Like

How do I do that? Assigned to what…

1 Like

You’re picking up an actor? It needs to be = that actor, then…

1 Like

Im not pickuing the actor tho, I just coded a variable that states if Im holding an item or not, the actor itself just gets destrouyed

1 Like

I’m guessing it needs to be set to this actor.

1 Like

As an example, if I was ‘picking up’ using a line trace, and I wanted to set the ‘camera mesh’ to the mesh of the actor I’d just seen, then

2 Likes

YESSS, THANK YOU SO MUCH! You saved my life!

3 Likes