Hi, i have this object i created in C# called Skill.
this is the object :
public class Skill {
string Name;
float Effect;
float CastTime;
SkillType Type;
float Cost;
int Times;
float Range;
int Thumbnail;
EffectProperties Ep;
public Skill(string Name, float Effect, float CastTime, SkillType Type, float Cost, int Times, float Range, int Thumbnail, EffectProperties Ep){
this.Name = Name;
this.Effect = Effect;
this.CastTime = CastTime;
this.Type = Type;
this.Cost = Cost;
this.Times = Times;
this.Range = Range;
this.Thumbnail = Thumbnail;
this.Ep = Ep;
}
public string namE {
get{ return Name; }
set{ Name = value; }
}
public float effect {
get{ return Effect; }
set{ Effect = value; }
}
public float castTime {
get{ return CastTime; }
set{ CastTime = value; }
}
public SkillType type {
get{ return Type; }
set{ Type = value; }
}
public float cost {
get{ return Cost; }
set{ Cost = value; }
}
public int times {
get{ return Times; }
set{ Times = value; }
}
public float range {
get{ return Range; }
set{ Range = value; }
}
public int thumbnail {
get{ return Thumbnail; }
set{ Thumbnail = value; }
}
public EffectProperties ep{
get{ return Ep; }
set{ Ep = value; }
}
}
public struct EffectProperties {
private bool atTarget;
private bool projectile;
private int particles;
private float lifeTime;
public EffectProperties(bool atTar, bool Proj, int Par, float lifeT){
atTarget = atTar;
projectile = Proj;
particles = Par;
lifeTime = lifeT;
}
public bool AtTarget{
get{ return atTarget; }
set{ atTarget = value; }
}
public bool Projectile{
get{ return projectile; }
set{ projectile = value; }
}
public int Particles{
get{ return particles; }
set{ particles = value; }
}
public float LifeTime{
get{ return lifeTime; }
set{ lifeTime = value; }
}
}
public enum SkillType{
passive,
offensive
}
and i have made an editor script for it so i can see the object in the inspector when ever i type public Skill myVar; int a script.
but the problem is that i keep getting an error from the SkillEditor.cs script that says
error CS0030: Cannot convert type UnityEngine.Object' to
Skill’ and i dont know how to solve it. please help, here is my SkillEditor.cs script:
using UnityEngine;
using UnityEditor;
using System.Collections;
[CustomEditor (typeof(Stats))]
public class SkillEditor : Editor {
public override void OnInspectorGUI(){
Skill pp = (Skill)target;
GUILayout.Label("Skill Object Editor");
pp.castTime = EditorGUILayout.FloatField("Cast Time",pp.castTime);
}
}
thanks for reading