how to modify one C# script through another script ? unity code example
Example 1: unity variable from another script
//Make Health public
public class PlayerScript: MonoBehaviour {
public float Health = 100.0f;
}
//Access it.
public class Accessor : MonoBehaviour {
void Start()
{
GameObject thePlayer = GameObject.Find("ThePlayer");
PlayerScript playerScript = thePlayer.GetComponent<PlayerScript>();
playerScript.Health -= 10.0f;
}
}
Example 2: How to call one shell script from another shell script?
#!/bin/bash
SCRIPT_PATH="/path/to/script.sh"
"$SCRIPT_PATH"
. "$SCRIPT_PATH"
source "$SCRIPT_PATH"
bash "$SCRIPT_PATH"
eval '"$SCRIPT_PATH"'
OUTPUT=$("$SCRIPT_PATH")
echo $OUTPUT
OUTPUT=`"$SCRIPT_PATH"`
echo $OUTPUT
("$SCRIPT_PATH")
(exec "$SCRIPT_PATH")