Skip to content

Instantly share code, notes, and snippets.

@unity3dcollege
Created July 2, 2017 19:42
Show Gist options
  • Save unity3dcollege/4e742344585e371091324f0e0ccbbb7e to your computer and use it in GitHub Desktop.
Save unity3dcollege/4e742344585e371091324f0e0ccbbb7e to your computer and use it in GitHub Desktop.
using UnityEngine;
[ExecuteInEditMode()]
public class RectTransformLockPosition : MonoBehaviour
{
private RectTransform rectTransform;
private Vector3 startPosition;
protected void Awake()
{
rectTransform = GetComponent<RectTransform>();
startPosition = transform.position;
}
private void LateUpdate()
{
if (startPosition != null)
{
rectTransform.position = startPosition;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment