Hi
I’m trying to cast from an actor class to my character. I have tried a couple different things and am currently trying to use an actor class reference with the object selected in my scene and then connecting that to me object reference for the casting node. However, I am noticing the default value does not actually change. I am relatively new to unreal and am still pretty confused about this. I was hoping for some recommends on how to make this work.
All bp you created in your content browser(file asset) are classes, you can view them as a non-living things. So when you view it detail panel inside it bp class, they will show only default variable that can be changed manually in the editor(not ingame).
When you spawn/placed a file asset/bp class into your level map, it become an actor/object and start to live. When you hit Play, check out your Outliner window(right side) and select your BP_FirstPersonCharacter>detail panel and you will see the change in value ingame. We called that an instance of a class.
How does the player know which actor you mean:
trying to use an actor class reference with the object selected in my scene
How are you doing it? How do you select the object?
I placed my first person character in the world and then went over to the variables section on the details panel of my character and selected BP_SpawnablePlatform
Which one of the two? Could we see it in the level? Technically, if done correctly, you wouldn’t even need to cast.
What are the chances another player is spawned and possessed? By default, the Game Mode will spawn one.
Are you sure you’re possessing the player you’ve manually placed in the level?
I was using ActorObjectRef when doing so. I have my player selected. The only other thing I have in my world at the moment is the player start and the platform. It should be noted that I plan on having multiple of these spawnable platforms in the world at once and so I would need to cast to the specific one the player is standing on at any given time.
- when you start, do you start in mid air? Or do you start where the player start is?
- how many of those actors do you see in the Outliner while you play:
I’m thinking the Game Mode spawns an additional player and takes control of it, so the ref you set does not matter as this is not the player that we are possessing. That would explain the strange behaviour.
When I start I start at player start. I am seeing multiple BP_Firstpersoncharacters in my outliner, the second is in yellow and there is also an AIController.
That’s not what we want, right? That’s the issue. You’re assigning a platform actor to a variable of the character you’ve placed in the level but control another character - the one that spawns dynamically. Most likely.
If you want to have a character in the level planed manually, remove the player start and remove the Pawn
from the Game Mode
. Then ensure the character you’ve placed manually is getting possessed:
Do tell once you get to a point where you only see 1 character in the outliner.
Ok I just got it. It seems the cast is not failing but the z value for my spawnable platform still is not level. Thank you so much for all the help.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.