Avoid function being called every frame (on Start void)


well I have a script that is attached to a gameobject the problem is that Start is called every frame (I don’t know why) and there I have a function that adds some information to a Dictionary, and every second is created a new entry on the dictionary.

How can I call the function only one time?

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class Ammo {

	public float ammoboxSize;


public class CurWeapons {

	public static Dictionary<string, Ammo> ammoLib = new Dictionary<string, Ammo>();

	public static void SetNewWeapon(string str, Ammo lib) {
		Debug.Log ("Key " + str + " added.");
		ammoLib.Add(str, lib);

	public static Ammo RetrieveInfo(string name) {
		return ammoLib[name];

	public static void ChangeAmmo(string name, float bullets) {

		Ammo tempAmmoPreset = ammoLib[name];
		tempAmmoPreset.ammoboxSize = bullets;

		ammoLib[name] = tempAmmoPreset;



public class AmmoScript : MonoBehaviour {

	public float ammo_boxSize = 32;

	// Use this for initialization
	void Start () {
		Ammo ammoPreset;

		ammoPreset = new Ammo();
		ammoPreset.ammoboxSize = ammo_boxSize;
		CurWeapons.SetNewWeapon(transform.name, ammoPreset);
	// Update is called once per frame
	void Update () {

That code is used to determine the capacity of a weapon, and sets the number of bullets that It have.


I solve it, checking if the current key exists on the dictionary.