Void start not working?

I am trying to make it so when the scene is loaded it changes the the variable int rand to Random.Rage(1,20). Here is the script so you can get more of an idea using UnityEngine;using System.Collections;public class CivAiFollower : Mo - Pastebin.com

Your problem is that you keep declaring a new variable every time you use Random.Range().

//declaring a field in the class. accessible everywhere in this class
    public int rand;

    void Start ()
    {
//declaring a second variable that is only accessible in this method
            int rand = Random.Range(1,20);
    }

    void OnTriggerEnter(Collider collision)
    {
        if(collision.transform.name == "node")
        {
//declaring a third variable that is only accessible in this method
            int rand = Random.Range(1,20);
        }
    }

When you write VariableType variableName e.g. int someIntVariable you are reserving a spot in memory for a new piece of information for a new variable.

You probably want to use just the one variable you declare as a field in the beginning of the class so just convert all other int rand = Random.Range(1,20); lines to just rand = Random.Range(1,20); and it should fix this issue.

//Can you log this in your console ?

	void Start ()
	{
		

		Debug.Log(" I am in Start");
		int rand = Random.Range(1,20);
		Debug.Log(" Random number is" + rand);
}

or are you getting same number each time ?