Created
February 10, 2023 02:18
-
-
Save haramakoto/50853885491e29f3f181d59eded0d750 to your computer and use it in GitHub Desktop.
RendererのBoundsを設定する
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
namespace hoge.hoge | |
{ | |
using UnityEngine; | |
public class BoundsSetter : MonoBehaviour | |
{ | |
[SerializeField] | |
private Vector3 targetBoundsSize; | |
private void Start() | |
{ | |
this.SetBounds(); | |
} | |
[ContextMenu("SetBounds")] | |
private void SetBounds() | |
{ | |
Bounds currentBounds = this.GetComponent<Renderer>().localBounds; | |
currentBounds.extents = this.targetBoundsSize; | |
this.GetComponent<Renderer>().localBounds = currentBounds; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment