Hello. I’ve currently got an utterly baffling problem with assigning variables in one of my scripts. Basically, the value I’m assigning is completely different from the one being used in the game. The script below holds data for weapons, and is very simple. Code:
using UnityEngine;
using System.Collections;
public class WeaponStats : MonoBehaviour {
WeaponEquip weaponEquip;
//Scimitar
[HideInInspector]public float scim_one_speed = 4.0f;
[HideInInspector]public int scim_one_damage = 50;
//Dagger
[HideInInspector]public float dagger_one_speed = 0.0f;
[HideInInspector]public int dagger_one_damage = 34;
void Start () {
Debug.Log (scim_one_speed);
Debug.Log (dagger_one_speed);
}
}
You’d expect the console to print off ‘4.0’ and ‘0.0’ as those two variables. Nope. The strangest part is that the console doesn’t just print off two incorrect values, it prints off four. According to Unity, ‘scim_one_speed’ is simultaneously ‘1’ and ‘0’, while ‘dagger_one_speed’ is simultaneously ‘0.75’ and ‘0’ at run-time. If anyone has any idea why this is happening, I’d be very grateful for their help.