How to get a variable from actor in a list of objects?
Hi, I have an actor with a list of actors as a variable. All the listed actors inherit from the same class with 2 variables (Name, texture). As I understand, I can't use the "actor" type for the list if I want to edit the "default" list, instead I have to use the type "object". But once listed as objects I can't get the actor's info from them.
The use of objects to set elements in a default list is necessary??
Can anyone help me with this process?
asked Dec 29 '16 at 03:38 PM in Blueprint Scripting
You can cast to the the actor you want the default variables from. Have a look at this -> https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/CastNodes/
answered Dec 29 '16 at 04:44 PM
Get All Actors of Class (the child actor class type) Get (0) and drag off Get Parent Actor.
Cast that into the Class type of the parent.
You should then be able to drag out the variables stored in the Parent class.
(seems like this is a long way to get there, but no simpler chain comes to mind that would net a valid cast result)
At the end I used a list of classes in MyGameInstance and a function to return the appropiate class. The function inputs an integer and outputs a class type. The menu bluprint then can "spawn actor of class".
The problem now, unrelated or not, is that the project crash when loading and I can't continue. The crash points to the Menu blueprint so, perhaps it is related. I'm on 4.14.3.
Thanks for the help!
Edit: Here is my crash and a workaround to resolve it: https://answers.unrealengine.com/questions/528455/child-actor-component-keeps-corrupting-its-parent.html
Follow this question
Once you sign in you will be able to subscribe for any updates here