- Home /
How to create a custom function out of script (See the answer for more)
I want to know if there's a way to create custom function, like a script plug-in:
I'll show you an explample for the result i want: using UnityEngine.plugin_name
Calculate.position.add.x = value;
will execute :
gameObject.transform.position = new Vector3(gameObject.transform.position.x + value, ... , ...);
i don't no if you understand, if not, just tell my how i can make my question better. Sorry for short question and bad english...
So, if I understand correctly you want to execute a function when the user changes the value of "Calculate.position.add.x"?
"Calculate.position.add.x" is just an exemple, what i really want is a custom 'something or function' which you can give an output or input, example: Calculate.position.add.x = value; This 'something or function which i don't know the name' is an output, like a code shortcut. When the player write this in a script, this shortcut will be executed. I want also to make an custom 'something or function which i don't know the name' input... When write in a script: variable = Calulate.outputexample; So, yes you understand my "un-understandable" question.
Answer by RChrispy · Sep 30, 2015 at 07:30 AM
Hey if you mean extensions then here is an example on another post of mine just scroll down:
http://answers.unity3d.com/questions/571414/is-there-a-way-to-check-if-an-animatorcontroller-h.html
Extensions can be used to "extend" existing functionality.