This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEngine; | |
namespace Utility.SLayout { | |
[CustomEditor(typeof(SHorizontalOrVerticalLayoutGroup), true)] | |
[CanEditMultipleObjects] | |
/// <summary> | |
/// Custom Editor for the HorizontalOrVerticalLayoutGroupEditor Component. | |
/// Extend this class to write a custom editor for a component derived from HorizontalOrVerticalLayoutGroupEditor. | |
/// </summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine.UI; | |
[RequireComponent(typeof(RectTransform), typeof(LayoutElement))] | |
[ExecuteInEditMode] | |
public class LayoutElementFitParent : MonoBehaviour | |
{ | |
[SerializeField] private float aspectRatio = 1; | |
[SerializeField] private bool updateMin = false; | |
[SerializeField] private bool updatePreferred = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://forum.unity.com/threads/overlay-canvas-and-world-space-coordinates.291108/#post-9627593 | |
// translating between overlay canvas and world space coordinates | |
uiObject.transform.position = RectTransformUtility.WorldToScreenPoint(Camera.main, worldObject.transform.TransformPoint(Vector3.zero)); | |
-------- | |
// http://answers.unity3d.com/questions/799616/unity-46-beta-19-how-to-convert-from-world-space-t.html | |
//this is your object that you want to have the UI element hovering over |