Hey, I'm new to using classes in Unity. I'm trying to make a player class for a 2d platformer, so I can initialize the player character every level without having to rely on creating a prefab then setting every variable from scratch every level. ill provide exact code if needed.
the problem, I have multiple scripts on the player character, such as a moving script, an attacking script, a health script, a special dashing script, as well as any that I would add in the future.
some scripts need access to the same variable, such as moving and the special dash needing rigidbody, but attacking and health don't. i'm already not sure what best way to do this is, but as of now I have a "player : monobehaviour" class, as well as the 4 other scripts "moving : player". i feel like there's a better way to do it, but that's what I've been using
the problem is, when initializing the player, I have to call it through one of the scripts, like Player<Moving>(), and then that only sets the variables for that script. i think im missing something obvious here, but ive been coding nonstop for the past 6 hours and my brain is kinda fried.