i literally just dont know how to call a function from another class :/

First, you must spawn the actor in the world with the SpawnActor() function, or get a reference to it somewhere if you spawned it somewhere else.



AItem* Item = SpawnActor<AItem>(SpawnLocation, SpawnRotation);


if(Item) {
     Item->DoStuff();
}


There is no need to cast since SpawnActor() is a template function. The class you specify in the angle brackets will be the return type of the function.

Casting is only necessary if you already have an object and wish to convert it to another related class type, such as casting an object from an AActor to an ACharacter.