# Accessed None trying to read property \[Pawn\]

**URL:** <https://forums.unrealengine.com/t/accessed-none-trying-to-read-property-pawn/788534>\
**Category:** Blueprint\
**Tags:** unreal-engine, question, CPP, Blueprint\
**Created:** [March 11, 2023, 2:11pm UTC](https://forums.unrealengine.com/t/accessed-none-trying-to-read-property-pawn/788534 "2023-03-11T14:11:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xianthryllis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xianthryllis](https://forums.unrealengine.com/u/xianthryllis)\
**Post date:** [March 11, 2023, 2:11pm UTC](https://forums.unrealengine.com/t/accessed-none-trying-to-read-property-pawn/788534/1 "2023-03-11T14:11:53Z")

</div>

I am trying to set the initial position of a camera on load. Then I should be able to move it upwards when I press the Up arrow in the keyboard. Here is my blueprint. SpawnCamera and MoveCameraUp functions are scripts I made in C++

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/9/8/298fe67707190625a3378fadc7056cbecf36ed87.png)

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/e/8/be825d6902190f4a7446b72c29fe43904a2073c5.png)

I get the error in the log saying _Accessed None trying to read property DomeCameraPawnReference_ for both BeginPlay and Keypress Up events.

I’ve read that such error means there’s something wrong with the Target, but I’m not sure what is wrong in mine.

If it helps, here’s also my C++ codes:

void ADomeCameraPawn::SpawnCamera()  
{  
FActorSpawnParameters spawnParams;  
spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;  
GetWorld()-\>SpawnActor(CameraActorToSpawn, InitialTransformPosition, spawnParams);  
}

void ADomeCameraPawn::MoveCameraUp()  
{  
FVector Location = GetActorLocation();  
FVector VectorUp = FVector(0, 0, MovementIncrement);  
Location += VectorUp;  
SetActorLocation(Location);  
}

TIA.

Additional info: I saw this post: [Accessed None trying to read property Stored Pawn](https://forums.unrealengine.com/t/accessed-none-trying-to-read-property-stored-pawn/73073) but it didnt help me.

---

<div class="post-metadata">

**Author:** ![rokenrock](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rokenrock/32/1040844_2.png) [@rokenrock](https://forums.unrealengine.com/u/rokenrock)\
**Post date:** [March 11, 2023, 3:51pm UTC](https://forums.unrealengine.com/t/accessed-none-trying-to-read-property-pawn/788534/2 "2023-03-11T15:51:18Z")

</div>

" _Accessed None trying to read property DomeCameraPawnReference_"  
Means that DomeCameraPawnReference isn’t instantiated. It’s empty. It doesn’t reference anything. It doesn’t exist.

If SpawnCamera spawns DomeCameraPawnReference, and SpawnCamera is in the class that DomeCameraPawnReference is, you should make SpawnCamera static and return a reference to the spawned actor.

---

<div class="post-metadata">

**Author:** ![xianthryllis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xianthryllis](https://forums.unrealengine.com/u/xianthryllis)\
**Post date:** [March 11, 2023, 3:51pm UTC](https://forums.unrealengine.com/t/accessed-none-trying-to-read-property-pawn/788534/3 "2023-03-11T15:51:38Z")

</div>

Figured it out. The answer is casting:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/0/b/f0b1864dd389bf8a436fe9f9457379b450b0f0b1.png)
