예제 #1
0
 void Start()
 {
     //Retrieving a reference to FlatFX object
     flatfx = GameObject.Find("FlatFX").GetComponent <FlatFX>();
     //Retrieving a reference to the the camera
     cam = GetComponent <Camera>();
     //Retrieving a number of defined effects
     maxEffect = FlatFXType.GetNames(typeof(FlatFXType)).Length;
     //Retrieving a reference to the text
     text = GameObject.Find("LabelText").GetComponent <Text>();
     //Setting label to the effect which is currently selected
     UpdateLabel();
 }
    static void Create()
    {
        GameObject go = new GameObject();

        go.AddComponent <FlatFX>();
        go.name = "FlatFX";
        FlatFX script = go.GetComponent <FlatFX>();

        //Set default material
        script.SetMaterial(AssetDatabase.GetBuiltinExtraResource <Material>("Sprites-Default.mat"));
        //Set default settings
        TextAsset jsonAsset = (TextAsset)Resources.Load("FlatFXSettingsDefault", typeof(TextAsset));

        JsonUtility.FromJsonOverwrite(jsonAsset.text, script);
        //Select the new object
        Selection.activeGameObject = go;
    }
 void Awake()
 {
     script = (FlatFX)target;
     //script.runInEditMode=true;
 }