Skip to content

Instantly share code, notes, and snippets.

@makochang
makochang / InputTime.cs
Created November 15, 2022 08:39
アニメーション残り0.25秒だけ入力を受け付ける
using UnityEngine;
public class InputTime : MonoBehaviour
{
public Animator animator;
// Start is called before the first frame update
void Start()
{
animator = GetComponent<Animator>();
@makochang
makochang / UnitySS.cs
Last active October 7, 2021 11:22
Unityスクリーンショットを撮る
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SS_Matsuda : MonoBehaviour
{
private void Update()
{
// スペースキーが押されたら
if (Input.GetKeyDown(KeyCode.Space))
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour
{
private int hp;
public int GetHp ()
{
return hp;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Example : MonoBehaviour
{
// Use this for initialization
void Start ()
{
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>タイトル</title>
</head>
<body>
<h1>見出し</h1>
float deg; //Degree
float rad; //Radian
//180°
deg = 180.0f;
//πラジアン
rad = Mathf.PI;
//180°はπラジアン≒3.141593
Debug.Log(deg * Mathf.Deg2Rad);
using UnityEngine;
using System.Collections;
public class Cube : MonoBehaviour
{
void Update()
{
//Wキーが押されたら、0,1,0へ移動.
if (Input.GetKeyDown(KeyCode.W))
{
@makochang
makochang / FileIO.cs
Last active August 29, 2015 14:26
Unityでテキストファイルを読み書きする静的クラス
using UnityEngine;
using System.Collections;
using System.IO;
using System;
/// <summary>
/// Unityでテキストファイルを読み書きする.
/// このファイルは静的クラスのため「Standard Assets」または「Plugins」フォルダーに配置する.
/// このファイルは静的クラスのため特定のオブジェクトにアタッチしてはいけない.
/// </summary>
@makochang
makochang / FileIO.cs
Last active August 29, 2015 14:26
Unity C#でファイルの読み書きをする
using UnityEngine;
using System.Collections;
using System.IO;
public class FileIO : MonoBehaviour
{
//ファイル名.
private string fileName = "theFile.txt";
//データパス.
private string dataPath;
@makochang
makochang / DrawDraggingLine.cs
Created May 12, 2015 03:27
Unity マウスでドラッグした場所に線を描画(デバッグ)
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class DrawDraggingLine : MonoBehaviour
{
//ドラッグ中に真.
private bool isDragging = false;
//線の座標リスト.
private List<Vector3> linePoints = new List<Vector3> ();