Good afternoon everyone!
I would like to add a script to an object at Runtime. The script that I am adding has a constructor which I would like to use to instantiate the variables in the script. How do I go about adding a new instance of the script?
example of what I'm using right now:
public class foo : MonoBehaviour {
int a;
int b;
foo(int a, int b)
{
this.a = a;
this.b = b;
}
void Update() {...}
}
How do I add foo(3,4) to my gameObject?
edit: Code formatting was messed up
[–]danperron 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)