UNITY An object reference is required to access non-static member 'Outline.OutlineMode'

0

I'm trying in Unity to get an object to have a border of a color when you approach it. For this I downloaded the asset "Quick Outline" and I am using your code. It works but I want that when it is already On it stops activating, the problem is that it does not let me mark it or I do not know how to do it, this is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Cama : MonoBehaviour {

    void OnTriggerStay(Collider other) {
        outline();
        if (Outline.OutlineMode == Outline.Mode.OutlineAll) {
                Debug.Log("test");

        }
    }

    void outline() {
        var outline = gameObject.AddComponent<Outline>();
        outline.OutlineMode = Outline.Mode.OutlineAll;
        outline.OutlineColor = Color.yellow;
        outline.OutlineWidth = 5f;

    }
} 
    
asked by Axel Velasco 21.10.2018 в 17:45
source

0 answers