AK056/Assets/GameLogic/Game/Extension/GameObjectExtension.cs
2025-05-08 13:38:55 +08:00

28 lines
917 B
C#

using UnityEngine;
namespace GameLogic
{
public static class GameObjectExtension
{
public static void SetPosition(this GameObject self, Vector3 position)
{
self.transform.position = position;
}
public static void SetPosition(this GameObject self, Transform transform)
{
self.transform.position = transform.position;
}
public static void SetTransformNoScale(this GameObject self, Transform transform)
{
self.transform.position = transform.position;
self.transform.rotation = transform.rotation;
}
public static void SetTransform(this GameObject self, Transform transform)
{
self.transform.position = transform.position;
self.transform.rotation = transform.rotation;
self.transform.localScale = transform.localScale;
}
}
}