Hi,
I have the following setup:
MainCamera render everything except ImageTurret layer.
TurretCamera render only ImageTurret layer on a RawImage
My problem is:
MainCamera render everything and TurretCamera render nothing
I have the following script:
using UnityEngine;
using System.Collections;
public class TurretUI : MonoBehaviour {
public GameObject ui;
private GameObject target;
public void SetTarget(GameObject _target)
{
target = _target;
//transform.position = target.GetBuildPosition();
target.gameObject.layer = LayerMask.NameToLayer("TurretImage");
target.transform.GetChild(2).gameObject.layer = LayerMask.NameToLayer("TurretImage");
target.transform.GetChild(0).gameObject.SetActive(true);
target.transform.GetChild(1).gameObject.SetActive(true);
ui.SetActive(true);
}
public void Hide(GameObject target)
{
if(target !=null)
{
target.gameObject.layer = LayerMask.NameToLayer("Default");
target.transform.GetChild(2).gameObject.layer = LayerMask.NameToLayer("Default");
target.transform.GetChild(0).gameObject.SetActive(false);
target.transform.GetChild(1).gameObject.SetActive(false);
}
ui.SetActive(false);
}
}