Hello, I discovered this developer forum less than a week ago, and if possible I need some help.
What I am trying to do: I have 2 scenes in my Unity application, the first one there are some input fields and dropdowns, and one of these dropdowns is for choosing the hand that I want to render in the next scene (like a setup menu). And the next scene is for what I want to do with the hand. But I couldn't deactivate the hand that I don't want to be shown.
I already tried to deactivate the GameObject attached to CapsuleHand (the graphic hand), like:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Leap.Unity;
using Leap;
public class renderizarMaoPaciente : MonoBehaviour {
private HandModelBase renderHand;
public static string chosenHand;
public static bool leftHand = false;
public static bool rightHand = false;
// Use this for initialization
void Start () {
renderHand= this.gameObject.GetComponent<HandModelBase>();
chosenHand= startExercise.subjectHand;
if (renderHand!= null)
{
Hand objHand = renderHand.GetLeapHand();
leftHand = objHand.IsLeft;
rightHand = objHand.IsRight;
}
}
// Update is called once per frame
void Update () {
if ((string.Equals("Left",chosenHand) && rightHand ) || (string.Equals(chosenHand,"Right") && leftHand))
{
//if the chosen hand is left and the hand of this gameobject is the right hand, deactivate it and vice versa
this.gameObject.SetActive(false);
}
else
{
this.gameObject.SetActive(true);
}
}
}
I don't know if the HandEnableDisable script activates the gameObject deactivated in the script above.
I think it has nothing about to the Model Pool for the HandPool, because I can choose or the right hand or the left hand, and both need to be assigned to the HandPool. But I really need to make visible only one of them. Does anyone know what I can do to solve this?
Thanks in advance,
Milena