Download

Unable to spawn correct actor because of bad class cast

So I have a InventoryItem BP that that has a blank StaticMeshComponent and get’s inherited in a BoxItem BP. In the BoxItem BP I have stretched the box(this will be relevant in a second). Their are many items going to be inheriting from InventoryItem BP so I can’t just set the class as that because when I do, it spawns an unmodified BoxItem. It also won’t let me use the GetClass node that is up there because Object is not compatible with Actor class. Is their some other way to spawn the correct actor?

I can’t access UE now to confirm these but variables have an option as ‘Expose on Spawn’. This allows you to modify bp variables on spawn actor node. With this way you set your damage,price etc. variables to customize your generic item. Also spawn node has output for spawned actor,use this to cast and change mesh of your actor (you probably don’t need to use cast,as it is already referenced with that output pin). If this don’t work,you can make meshes variable dependent. This way if variable says ‘box’,mesh changes to box.

So my mistake. It does spawn the correct actor class but it doesn’t spawn it with the modifications I made to it. Dragging from the content browser has the changes but spawning it does not, weird. Thanks anyways.