Game Development Reference
In-Depth Information
}
}
Tip
get : We use the get keyword here because we don't want to set a value outside
of this class. This is very helpful to prevent an error from setting the value of this
variable outside of this class.
7. Next, we still need to create the last class, which is similar to the ItemsCon-
tainer class, but this one will contain the skill information; go to Assets |
Create | Javascript (for Unity JavaScript users) or Assets | Create | C# (for C#
users), name it SkillsContainer , double-click on it to launch MonoDevel-
op , and replace the code as follows:
// Unity JavaScript user:
#pragma strict
class SkillsContainer {
private var _guiContent : GUIContent;
private var _skillBoxTexture : Texture;
function get guiContent () : GUIContent {
return _guiContent;
}
function Init ( skillBoxTexture : Texture ) : void {
_guiContent = new GUIContent("");
_skillBoxTexture = skillBoxTexture;
}
}
// C# user (put the code inside the class):
using UnityEngine;
using System.Collections;
[System.Serializable]
public class SkillsContainer {
GUIContent _guiContent;
Texture _skillBoxTexture;
Search WWH ::




Custom Search