Safe an Actor in InventoryArray
i just want to test out a simple inventory, consists out of an array of actors.
What i have is the class AItem : AActor this only has a var ItemName which i want to display OnScreen.
And the class APlayerCharacter : ACharacter
So i made me a "TArray" TArray CharInventory; to store Items in it inside APlayerChar...
So for testing i tried to instance an actor inside the character which look like this: AItem* testItem = GetWorld()->SpawnActor(CharInventory, this);
this is the error i got at the moment: shows between the ptrArrow GetWorld()->SpawnActor no Instance of overloaded function "UWorld::SpawnActor" matches the argument list. Argument types are (AItem , APlayerCharacter )
nothing worked so far i only get errors on and on and i dont understand why. Could you help me out?
asked Jul 14 '14 at 01:54 PM in C++ Programming
Because SpawnActor requires UClass* which is class identifier from which you can create instance of a actor class, you can get UClass poiiter f using GetClass() from active instance or ASomeClass::StaticClass() from not instantiated actor where ASomeClass is name of your class.
Considering you already have a instance of something in array you should use that instance insted of trying to spawning it over again.
Follow this question
Once you sign in you will be able to subscribe for any updates here