/// <summary> /// Set this Canvas up to draw the UI onto another Entity. /// </summary> /// <returns><c>true</c>, if target entity was setup correctly, <c>false</c> otherwise.</returns> /// <param name="target">Target Entity.</param> /// <param name="resolution">Resolution of UI texture in 3D space.</param> public bool SetupTargetEntity(Entity target, int resolution = 768) { if (target == null) { return(false); } byte[] data = new byte[resolution * resolution * 4]; if (TargetTexture != null) { TargetTexture.UpdateData(resolution, resolution, data); } else { TargetTexture = new Graphic(resolution, resolution, data, true, false, true); } return(SetupRenderMaterial(target)); }
/// <summary> /// Set this Canvas up to draw the UI onto another Entity. /// </summary> /// <returns><c>true</c>, if target entity was setup correctly, <c>false</c> otherwise.</returns> /// <param name="target">Target Entity.</param> /// <param name="resolution">Resolution of UI texture in 3D space.</param> public bool SetupTargetEntity(Entity target, int resolution = 768) { if (target == null) { return(false); } byte[] data = new byte[resolution * resolution * 4]; if (TargetTexture != null) { TargetTexture.UpdateData(resolution, resolution, data); RectTransform.Width = _targetTexture.Width; RectTransform.Height = _targetTexture.Height; } else { TargetTexture = new Graphic(resolution, resolution, data, false, true, true, Name + "_RenderTexture"); } return(SetupRenderMaterial(target)); }