Expose on Spawn is for the containing class. If your class spawns or references another class that has an exposed variable that you want to change on creation. You’ll have to make another variable on the Spawning class that is exposed, and set it manually to the other referenced actor.
In this case, spawn function cannot take exposed variables, because spawn class is kinda unknown. I think it works like spawn class is AActor, or something like that.
You should specify spawn class in spawn function, or cast to desired class after object spawned, and set variables you want.
Then no, you can’t expose that pin on the Spawn function, because the compiler doesn’t know which Actor will be spawned. You could create specific functions for each class grouping of actors that you were to spawn, these would then spawn the actor with the specified pins.
In BP1 I have a reference for the class I want to spawn which is BP2.
I have to spawn BP2 from BP1 using this actor reference and set the exposed variable on BP2.
the usual way of just reference the actor directly on the function wont work because the reference object changes all the time.
The reference is also set automatically based on other inputs. There cannot be any manual input here.
I did in fact find a workaround, I forgot to update this question. I made a blueprint interface event then called that using the newly created actor and passed my variables through that. Will update later with pics.
Hey Jimonions, Thanks for posting your workaround. I was having the same issue but I still can’t Understand how you connected the variables of your spawned blueprint to new ones.
Blueprint Interface Events - BPI’s do not require a specific target.
Since the spawn actor node has a variable going into the class reference input it cannot output a suitable reference that we can trigger an event from and pass through variables that way.
By calling this BPI event I can just hook up the spawn actor reference to the target input and that will do exactly the same thing as a regular event provided the spawned actor also supports that BPI event.
if you need more info on what BPIs are there are numerous tutorials out there.