Created
July 2, 2017 19:42
-
-
Save unity3dcollege/4e742344585e371091324f0e0ccbbb7e to your computer and use it in GitHub Desktop.
This file contains hidden or 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; | |
[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