I have a blueprint which spawns in other blueprints inside it to make up 1 physics object. But because what the blueprint is spawning is random, there is no specific class reference until its in game and the component is spawned. This means that when i try to find a variable in the class which is being spawned nothing shows up when i search for “get” like i normally do. The only current way i see round this problem is searching for the variable by name which would remove the need for the blueprint to already know which component is being spawned. I can’t find this on blueprints though.
I do not think that what you are describing is possible. You can only access a variable if a class declares the variable. Otherwise it would be a compiler error even for C++
I will talk about two options. Using a parent class would be less cumbersome but it would only work if your randomly spawned classes have enough in common to have a base class. If not you could define an interface.
- Parent Class You could make your random classes all have a single parent class. You would then define your variable on the Parent Class. When you spawn the random object, you would cast it to the parent class and access your variable from there.
- Using Interfaces If your random classes have very little in common and you do not want them to have a single parent class you could use an interface.
- Create a blueprint interface
- Define an interface function (i.e. Get Variable ) within the newly created Interface
- In each of your random classes you implement the interface by adding it to the list of interfaces on Class Defaults and by adding the new event on the Event Graph
- Now you can send a message to your randomly spawned class (use the interface Message not Function Call)