You change properties of any Component (Unity Component or Script) by getting a reference to the Component and using that.
Assuming that the component is actually on your GameObject:
ComponentType component = GetComponent<ComponentType>();
component.RandomProperty = randomValue;
Example:
Rigidbody rigidbody = GetComponent<Rigidbody>();
rigidbody.freezeRotation = true;
You can use GameObject.AddComponent<ComponentType>();
to Add a component.
Any component needs to derive from MonoBehaviour in order to be able to attach to a GameObject.
See:
GameObject.GetComponent
GameObject.AddComponent
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…