Skip to content

Instantly share code, notes, and snippets.

@yumehachi
Created November 27, 2013 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yumehachi/7676274 to your computer and use it in GitHub Desktop.
Save yumehachi/7676274 to your computer and use it in GitHub Desktop.
Transformの設定
using UnityEngine;
using System.Collections;
/// <summary>
/// Utility
/// </summary>
/// <author>
/// Create by yumehachi on 2013/11/27
/// </author>
public static class Utility
{
public static void SetTransformPositionX (this Transform transform, float x)
{
Vector3 newPosition = new Vector3 (x, transform.position.y, transform.position.z);
transform.position = newPosition;
}
public static void SetTransformPositionY (this Transform transform, float y)
{
Vector3 newPosition = new Vector3 (transform.position.x, y, transform.position.z);
transform.position = newPosition;
}
public static void SetTransformPositionZ (this Transform transform, float z)
{
Vector3 newPosition = new Vector3 (transform.position.x, transform.position.y, z);
transform.position = newPosition;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment