i made an actor called chest. i made a component called inventory. inventory has 2 variables so far. size(integer) which lets me set its value in the chest blueprint. and items(array of items) which does not let me set its values in the chest blueprint. thats problem one sorta.
problem 2. i want to add this chest to another actor(actorB) and manipulate it in the viewport as if its a component.
so i tried making a chest a scene component. new problem. i cant set its static mesh or its inventory in the viewport of actorB
so i tried making chest a static mesh component . now i can set the static mesh in actorb’s viewport… but not the inventory.
Suggestion: Screen captures of blueprints or unreal windows helps others to determine issues. Since inventory are fairly common need try a google search for Unreal inventory for suggestions and basic guide.
the screenshot is from the chest componenets details inside of actorB.
i dont think its possible without making chest a c++ class, im not even sure thats possible, or doing it in blueprints which creates more runtime processing.
basically i want to be able to create instances of inventory and the items in the inventory from the details pane and not blueprint so its stored instances and doesn’t have to be calculated every time it runs. is that even possible in c++? to parse thru the components and pass their variables to the details pane of whatever parent its in? im guessing its time i crack into ue4’s c++ because i hit roadblocks consistently with my design in blueprints alone. i just assumed this would be a built in editor feature which is why im asking after research.
my non c++ workaround so far is to have chestComponenet carry a variable array of strings(or ints) that can be filled out in the details panel that pass that info into the inventory in chests blueprint… but this really kills the modular aspect that compelled me to make inventory a component in the first place and creates more runtime processing so i was trying to avoid it.
acomp_inventory is an ActorComponent that holds an array of custom actors(items) and an int so far. but u cant pass instances in the viewport so an array of actors cannot be passed in the viewport.
last night i decided to slipt the chest.
one half is just made for placement in an actor viewport as a component. it takes in all the information that the premade chest actor holds thru parent actors details
one half is an actor that spawns using the components data at runtime.
i came up with a system that is modular with matching pairs for every premade variant of the “props” (basically actors that do something)
so i have
smcomp_propComponent (parent class static mesh component) goes in my level actor’s viewport. can set its info in its detail defaults.
and its pair is
act_prop (parent class actor) spawns at runtime. sounds redundant but it goes with my existing map level system. i can just pass smcomp_prop to it after spawning and it builds the prop. i chose that path to reduce memory as it throws away smcomp_prop after reading it.
so of course there’s propComponent_chest/prop_chest but theres also propComponent_custom/prop_custom where its booleans and matching variables for all the possible components and so i have modular prop at level design. looking at staticMesh and staticMeshComponent gave me the idea.
i tested taking a prop_chest casting it to a act_prop(the parent of chest)storing it in a variable then casting it back to a prop_chest and it retained all its original data. so is that stable? am i right to assume then it passed the reference to the original thru the 2 casts?