# Calling a function from another actor using its object reference in c++ \[Member is inaccessible\]

**URL:** <https://forums.unrealengine.com/t/calling-a-function-from-another-actor-using-its-object-reference-in-c-member-is-inaccessible/1257271>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, CPP, question\
**Created:** [August 10, 2023, 11:39pm UTC](https://forums.unrealengine.com/t/calling-a-function-from-another-actor-using-its-object-reference-in-c-member-is-inaccessible/1257271 "2023-08-10T23:39:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ReinPandora](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ReinPandora](https://forums.unrealengine.com/u/ReinPandora)\
**Post date:** [August 10, 2023, 11:39pm UTC](https://forums.unrealengine.com/t/calling-a-function-from-another-actor-using-its-object-reference-in-c-member-is-inaccessible/1257271/1 "2023-08-10T23:39:27Z")

</div>

Ill try to make this quick. I am learning C++ and Unreal engine, and I am trying to transform this group of nodes into a single c++ function :

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/2/b/b2b142802d170aed2d0d53e13f953e1c9855a6cf.jpeg)

Here is the function I’m working on :

```auto
void AR_ChunkManager::UpdateEveryChunk(FIntPoint PlayerPos, TArray<AR_Chunk*>& ObjectArray, TArray<FIntPoint>& PosArray,
	TArray<FR_ChunkValues>& ValuesArray, FR_MeshValues& MeshValues, TArray<FR_LODValues>& LODArray,
	FR_NoiseMap& NoiseMap, TArray<FR_LODInfo> LOD)
{
	int32 i = 0;
	for (AR_Chunk* Chunk : ObjectArray)
	{
		FR_UpdatedValues UpdatedValues = FindUpdatedValues(PlayerPos, PosArray[i], LOD);
		Chunk->UpdateChunk(ValuesArray[i], MeshValues, LODArray[i], NoiseMap, UpdatedValues, true);
		i++;
	}
}

```

This is the function I want to call (in R\_Chunk.h):

```auto
UFUNCTION(BlueprintCallable)
	void UpdateChunk(UPARAM(ref) FR_ChunkValues &ChunkValues, UPARAM(ref) FR_MeshValues& MeshValues,
		UPARAM(ref) FR_LODValues& LODValues, UPARAM(ref) FR_NoiseMap& NoiseMap,UPARAM(ref) FR_UpdatedValues& UpdatedValues, bool print);

```

Its giving me the error that the member in inaccessible, although it works fine in blueprints. Thank you!

---

<div class="post-metadata">

**Author:** ![Chatouille](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chatouille/32/1194622_2.png) [@Chatouille](https://forums.unrealengine.com/u/Chatouille)\
**Post date:** [August 11, 2023, 7:46am UTC](https://forums.unrealengine.com/t/calling-a-function-from-another-actor-using-its-object-reference-in-c-member-is-inaccessible/1257271/2 "2023-08-11T07:46:01Z")

</div>

try adding `public:` in your class in R\_Chunk.h before the function declaration

---

<div class="post-metadata">

**Author:** ![ReinPandora](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ReinPandora](https://forums.unrealengine.com/u/ReinPandora)\
**Post date:** [August 12, 2023, 7:50pm UTC](https://forums.unrealengine.com/t/calling-a-function-from-another-actor-using-its-object-reference-in-c-member-is-inaccessible/1257271/3 "2023-08-12T19:50:02Z")

</div>

Thanks, I completely forgot to check it!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [September 11, 2023, 7:50pm UTC](https://forums.unrealengine.com/t/calling-a-function-from-another-actor-using-its-object-reference-in-c-member-is-inaccessible/1257271/4 "2023-09-11T19:50:53Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
