How to set a variable of a non-monobehavior script from a monobehaviour script
My players stat script is a non-mono-behavior script that needs to change on the fly (I.E. Picking up an item might increase its attack, or defense) Since said item would be a gameobject it uses mono-behavior. I've tried making a new instance of the player stats in the gameobjects script using the new keyword
playerStats stats = new playerStats();
But found out real quick that this just copies it, and makes a new one... Because its not mono behavior I can't use things like getcComponent, or attach it to an empty object and link it in the transform. Any help, or advice would be appreciated
Your answer
![](https://koobas.hobune.stream/wayback/20220613001115im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
NullReferenceException in FiniteStateMachine with ThirdPersonCharacter 0 Answers
how do i make the player walk the direction the camera looks at 1 Answer
Reference a script you might not know the name to 1 Answer
[SOLVED] Player prefab not spawning 2 Answers
How do I add a simple jump function to this script? 2 Answers