- Home /
unity auto adding rigidbody to character controller
i have a character controller that isn't a rigidbody. none of my scripts adds the rigidbody component to my player, but if i hit play in the editor or build my project unity auto adds the rigidbody to it and it messes the player up. if its in the editor before i hit play and usually anything changed manually in the scene resets after you stop play mode. but the rigidbody stays on the character prefab after. i have saved the prefab into a prefab folder and even that is effected. even though its not in the scene. no matter how many times i remove the rigidbody on play its added again. ive even went through and disabled anything that could be doing it one at a time and still no luck. closing unity and reopening doesn't fix it either. please give me some help in solving this. im also using the mirror network package. but i didn't have this problem in the beginning. it just started happening.
Answer by LBardmask · May 29, 2021 at 05:29 AM
ok i have an update. im sure its some bug on unitys end. ive just enabled unitys urp and now it no longer adds the rigidbody to my player if i build or play in editor, as long as i dont touch anything on it though. if i change some variable or add a component or script unity adds it again, including the prefab in the assets. ive gone through every script that the player uses and every call to every script in each and none of them require, call, or use a rigidbody in anyway. im stumped. i dont want to have to redo my player from scratch, hes almost complete and has a lot of scripts and variables attatched to him.
Answer by Maniacbob · May 29, 2021 at 06:41 AM
Sounds like one of your scripts probably has a RequireComponent line on it. That will automatically add the component if it is missing. You should be able to search your project for the line and remove it.
ive already gone through all the scipts on the character and all of its childrens scripts and none of them require or use a rigidbody. and for some reason using unitys urp half fixed it so im thinking its a bug on unitys side