# Class of object variables unkown

**URL:** <https://forums.unrealengine.com/t/class-of-object-variables-unkown/2063842>\
**Category:** Programming & Scripting\
**Tags:** Variable, unreal-engine, Blueprint, question\
**Created:** [October 11, 2024, 6:15pm UTC](https://forums.unrealengine.com/t/class-of-object-variables-unkown/2063842 "2024-10-11T18:15:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tmny](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tmny](https://forums.unrealengine.com/u/Tmny)\
**Post date:** [October 11, 2024, 6:15pm UTC](https://forums.unrealengine.com/t/class-of-object-variables-unkown/2063842/1 "2024-10-11T18:15:21Z")

</div>

Apologies in advance, but I can’t find an answer to this basic question and ChatGPT is confused as hell.

I am spawning an actor by class in the BP\_FirstPersonCharacter of the starter content, which works find when select the class directly in the node.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/1/4/81468bce3d5a4d2c52bd4b097b644c30f35d4702.png)

What doesn’t work, is the same thing but with an object variable, because they all seem to be not initialized.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/4/3/543ef9a40563d90a1b58ac1c14d5abd65872d0b0.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/f/a/afaedcd70ca1789787f573770f5a9c0988e2bef5.png)

Variables in the Debugger at this node

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/6/2/6620524c867c4f2da6972f71f9ddd7f5932f6512.png)

---

<div class="post-metadata">

**Author:** ![Arodi007](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arodi007/32/1022275_2.png) [@Arodi007](https://forums.unrealengine.com/u/Arodi007)\
**Post date:** [October 11, 2024, 7:12pm UTC](https://forums.unrealengine.com/t/class-of-object-variables-unkown/2063842/2 "2024-10-11T19:12:10Z")

</div>

Make sure to set your class path from it detail panel Default Value:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/7/5/b754a801015e5bb22dbcc0e511b7385931ee95de.png)

---

<div class="post-metadata">

**Author:** ![Tmny](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tmny](https://forums.unrealengine.com/u/Tmny)\
**Post date:** [October 11, 2024, 7:27pm UTC](https://forums.unrealengine.com/t/class-of-object-variables-unkown/2063842/3 "2024-10-11T19:27:33Z")

</div>

Thanks, that worked.

My goal was to only use one Object Reference Variable so there’s only one variable to maintaine but I can’t set a default value in it. Is this the wrong approach?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/b/4/3b4815a732f8b9645c7af8322c368c6b555a433c.png)

---

<div class="post-metadata">

**Author:** ![Arodi007](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arodi007/32/1022275_2.png) [@Arodi007](https://forums.unrealengine.com/u/Arodi007)\
**Post date:** [October 11, 2024, 9:52pm UTC](https://forums.unrealengine.com/t/class-of-object-variables-unkown/2063842/4 "2024-10-11T21:52:08Z")

</div>

You can set a variable object ref either via bp node(using get actor of class for eg)  
but that BuildGhostTest need to be present on the level map before to be valid.

Or as Instance Editable when placed on the level map.

---

<div class="post-metadata">

**Author:** ![Tmny](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tmny](https://forums.unrealengine.com/u/Tmny)\
**Post date:** [October 12, 2024, 2:21am UTC](https://forums.unrealengine.com/t/class-of-object-variables-unkown/2063842/5 "2024-10-12T02:21:00Z")

</div>

That doesn’t seem to be a good solution for my problem. Can you recommend a better practice to approach this?

---

<div class="post-metadata">

**Author:** ![Arodi007](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/arodi007/32/1022275_2.png) [@Arodi007](https://forums.unrealengine.com/u/Arodi007)\
**Post date:** [October 12, 2024, 5:10am UTC](https://forums.unrealengine.com/t/class-of-object-variables-unkown/2063842/6 "2024-10-12T05:10:19Z")

</div>

What are you trying to achieve exactly ?

Here some quick info on class vs actor if that can help:

- class is a file bp asset present in your content browser.
- when you spawn a class or drag drop that class to the level map, it become an actor of that class
- so there can be many instances (actor) of a class, that why we need to declare specifically which actor ref is which from bp node.

---

<div class="post-metadata">

**Author:** ![Tmny](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tmny](https://forums.unrealengine.com/u/Tmny)\
**Post date:** [October 21, 2024, 2:20pm UTC](https://forums.unrealengine.com/t/class-of-object-variables-unkown/2063842/7 "2024-10-21T14:20:41Z")

</div>

Ah that makes sense.

My goal was to get the class and object reference out of one variable so that I don’t need to have two separate ones which basically do the same thing in my BP.

---

<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:** [November 20, 2024, 2:21pm UTC](https://forums.unrealengine.com/t/class-of-object-variables-unkown/2063842/8 "2024-11-20T14:21:02Z")

</div>

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