コード例 #1
0
    void Awake()
    {
        if (StaticRef == null) // if theres is not allerdaye a static ref makes this the static ref
        {
            DontDestroyOnLoad(gameObject);
            StaticRef = this;
        }
        else if (StaticRef != this) // is the allready is a ref , destory this
        {
            Destroy(this);
        }

        //get refeances

        controller = GetComponent<CharacterController>();

        anim = GetComponentInChildren<Animator>();

        CurrentState = State.canMove;
    }
コード例 #2
0
    void Awake()
    {
        if (StaticRef == null) // if theres is not allerdaye a static ref makes this the static ref
        {
            DontDestroyOnLoad(gameObject);
            StaticRef = this;
        }
        else if (StaticRef != this) // is the allready is a ref , destory this
        {
            Destroy(this);
        }

        //get refeances

        controller = GetComponent <CharacterController>();

        anim = GetComponentInChildren <Animator>();

        CurrentState = State.canMove;
    }