33 lines
1.0 KiB
C#
33 lines
1.0 KiB
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;
|
|
}
|
|
|
|
public static void SetParent(this GameObject self, Transform parent)
|
|
{
|
|
self.transform.SetParent(parent);
|
|
}
|
|
}
|
|
} |