- Home /
is it possible to rename a script with script?
This code is what i want but it doesent seem to work.
this.name="movescript";
I have muliple seperate movements that only apply to certain caracters. but the different code has certain variables in common. right now all the movements crowded in one big script. its kinda like this:
if (gameObject.name=="myfirstguy"){the big movement code is written here}
if (gameObject.name=="mysecondguy"){another big long movement code written here}
if (gameObject.name=="mythirdguy"){another big long movement code that my first 2 guys doesnt use}
i just thought maybe it would be easier on me to have them in seperate scripts.
there are other scripts that need to see if an object has one of these movement scripts in collisions and stuff. other scripts attached to the same object need access too. maybe even change a variable they would all share. i had an idea that it would be simpler GetComponent funtion if i could just look for one instead of ten.
Your answer
Follow this Question
Related Questions
2D Animation does not start 1 Answer
SendMessage or store reference and call directly? 1 Answer
How to add a script to an imported object 2 Answers
A basic question about collision 1 Answer