i’am new to Unreal and want to spawn an actor, from a assets list, but it does not working, i checked other posts and do it the same way, as the solutions there.
The cast failed, and debug information says “get asset” is the right one and “get class” refers to blueprint class
With a “Get A Copy” node. Right now you have “Get A Ref”. You can tell by the output shape (diamond is ref, circle/dot is copy).
I don’t know if that will fix it, but getting a hard reference and then getting class with a pure function seems like it wouldn’t work.
unfortunately the same result, I think it’s the cast, if I select the class manually I can select it directly in the “SpawnActor” method as “Base-L_01_01” that’s the name of the blueprint
Can you simply remove the cast and connect through? So that way you could feasibly change the index and spawn the actor just fine? I guess the worry here is that it needs to BE an actor asset to be spawned through “Spawn Actor”, so the class cast is something like a filter preventing non-actors from passing through. But yeah I saw where your issue was, an Actor class was going into the cast but it was returning “Unknown”.
i cant put the “get asset” value in, because its type object and the “get class” value is type object class. so how can i get the correct class from the asset?
there is also a "get object class"method, but they need a Element Handle (dont know whats these is)
okay that seems to be a bug, if i put the pin from “get class” into the class pin of “cast to actor class” by hand, it says me not possible, if i drag of the pin from “get class” into the backgrund and create a new node of “cast to actor class” its working
but if i run it, it throws the same error as above…
Try throwing a printstring in before the Cast, and in the output for the printstring plug in the return value and then run the game, see if it’s still returning “unknown”
Placeholder_C_2 (dont know why “C_2” is adde) is the Blueprint Actor, who has the code inside its Event Graph. For testing this code i created a new blueprint named “Placeholder” an put them into the scene, then i setup this code to start with “Event BeginPlay”. i want to get a array of all assets inside a specific folder in content browser, then get 1 element of this array with an variable “index” and spawn this element (its also a blueprint actor) into the scene. All around about is to create a buildingsystem in runtime.
i putted a new screenshot there is on the left side a “get Asset” node, look at the “Get Display name” node thats connected from it, there is a “watching string” with a value of “Base-L-01_01” thats exactly the name of the blueprint in content browser and thats also the name of the class i can select manually in the “spawnActor” node.
Well I’m glad you got something figured out, @fecreation!
As for your side note:
To get some attention for that, go ahead and make a new post! It’s unrelated enough that it warrants it, plus you’ll get a lot of new faces looking at it!