Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class PlayerUI : MonoBehaviour
- {
- private Player target;
- VariableJoystick _variableJoystick;
- // Start is called before the first frame update
- void Start()
- {
- }
- void Awake()
- {
- this.transform.SetParent(GameObject.Find("Canvas").GetComponent<Transform>(), false);
- }
- void Update()
- {
- if (target == null)
- {
- Destroy(this.gameObject);
- return;
- }
- }
- public void SetTarget(Player _target)
- {
- if (_target == null)
- {
- Debug.LogError("<Color=Red><a>Missing</a></Color> PlayMakerManager target for PlayerUI.SetTarget.", this);
- return;
- }
- // Cache references for efficiency
- target = _target;
- }
- }
Add Comment
Please, Sign In to add comment