Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. One way to do this would be:
  2.  
  3. 1.  In the Volund prefab, select the CameraEquipmentAvatar, create a new tag called AvatarCamera, and set the CameraEquipmentAvatar GameObject tag to AvatarCamera.
  4.  
  5. 2.  In UIMainPanel.cs, add/change
  6.  
  7.     [HideInInspector]
  8.     private GameObject[] inventoryCams;
  9.  
  10.     private void EnableDisableAvatarCameras(bool enableIt)
  11.     {
  12.         if (inventoryCams == null)
  13.         {
  14.             inventoryCams = GameObject.FindGameObjectsWithTag("AvatarCamera");
  15.         }
  16.  
  17.         foreach (var cam in inventoryCams)
  18.         {
  19.             cam.SetActive(enableIt);
  20.         }
  21.     }
  22.  
  23.     private void Update()
  24.     {
  25.         GameObject player = Player.localPlayer;
  26.         if (player)
  27.         {
  28.             if (inventoryCams == null)
  29.             {
  30.                 EnableDisableAvatarCameras(false);
  31.             }
  32.  
  33.             // hotkey (not while typing in chat, etc.)
  34.             if (Input.GetKeyDown(hotKey) && !UIUtils.AnyInputActive())
  35.             {
  36.                 panel.SetActive(!panel.activeSelf);
  37.                 EnableDisableAvatarCameras(panel.active);
  38.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement