i have a script called skills.js :
class Skill {
var damage: float;
var rate : float;
var hits : int;
var selected : boolean;
var name : String;
function Skill(nam : String, dmg : float, rat : float, hit : int, sel : boolean){
this.damage = dmg;
this.rate = rat;
this.hits = hit;
this.selected = sel;
this.name = nam;
}
}
punch = new Skill("punch", 5, 0.2, 1, false);
slash = new Skill("punch", 3, 0.1, 1, false);
headbutt = new Skill("punch", 8, 1, 1, false);
push = new Skill("punch", 2, 0.6, 1, false); `
and i want to access the it’s values properties in another script. for example in player.js:
var damage = skillScript.punch.damage;
but is won’t let me and it returns as a log warning when ever i start the game up. if somebody knows what i need to do please help. thanks for reading and here is the error if it helps:
NullReferenceException: Object reference not set to an instance of an object
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetProperty (System.Object target, System.String name)
UnityScript.Lang.UnityRuntimeServices.GetProperty (System.Object target, System.String name)
player.FixedUpdate () (at Assets/Scripts/player.js:54)
glad i could help and sorry for the inconvinience again
– rage_coill add an answer to both of your questions so that you can accept them and make it easy for future visitors to identify the problem
– rage_co