Remove or change variables dynamically

I made a character controlling an actor class… promoted the actor to variable but now if I want to call a function to change that actor to my second actor, it doesn’t let me change the variable type. (my goal is to change the ball I’m controlling dynamically by pressing numbers on my keyboard

How are you doing it, what error are you getting?

To cast a variable they have to be related to some degree. For example, through polymorphism.

Make a super class called BallSuperClass and a bunch of derived classes. Then make the variable of the type BallSuperClass and assign the different balls to that variable as you go.

What I would do to change the type is to store the common data and spawn a new instance of the new ball and destroy the old one.

Depends on how each part differ ofc.

HTH

sorry for uploading bad…

Thanks for your fast replies… I will learn and try what you said soon. have some exams tomorrow :slight_smile: