Entries from 2015-05-01 to 1 month
レベルの管理ってどうしたらいいのだろう。 以下のスクリプトで管理することはできるが、何かいい方法があれば教えて欲しいです。 using UnityEngine; using System.Collections; public class LevelManager : MonoBehaviour { public int CurrentLevel; pub…
全て同じ要領で、プロパティを参照することができる。 間違っていると思うときは添付して検索。 float GridSpace = Content.GetComponent<GridLayoutGroup>().spacing.y;</gridlayoutgroup>
UIを使うとき、「Canvas Scaler」を「scale with screen size」に設定するようにする。
オブジェクトがアクティブか非アクティブをbool型のtrue・falseで返す。 public void HomeButton(){ // ホーム画面に戻る操作。 Application.LoadLevel("Home"); play = false; if(ClearScreen.active = true){ ClearScreen.SetActive(false); } } Unityゲー…
シーンを切り替えても、オブジェクトが消えないようにする。 using UnityEngine; using System.Collections; public class GameManager : MonoBehaviour { void Awake(){ DontDestroyOnLoad(this.gameObject); } } Unity - Scene切替時でもGameObject等を破…
RaycastHit2Dのlayerを参照したい。 hit. transform. gameObject. layer http://docs.unity3d.com/ja/current/ScriptReference/RaycastHit2D.html 公式のページから、RaycastHit2Dは、 transformのプロパティを持っていることわかる。 transformからgameObje…
3D用の当たり判定は2D用では使えない。 コードを2Dように書く必要がある。2D用、例1 using UnityEngine; using System.Collections; public class ObjectManager3 : MonoBehaviour { public GameObject Prefab; void Start () { } void Update () { if(Inp…
is4cafe.hatenablog.com
マウスで押した場所を取得する。ActionScript入門Wiki - Unity - クリックした位置にオブジェクトを移動させるwww40.atwiki.jp
PuchwooshのXcodeの設定 以下の設定が必要 1. General imageIO libz 2. Info Pushwoosh_APPID : ID入力 Pushwoosh_SHOW_ALERT : YES Number One Push Notifications Service for Any Possible Product. 1 Service, 21 Platforms プッシュ通知とは? | サービ…
UIコンポーネントの位置は、rectTransformで扱うことができる。 public class CreditController : MonoBehaviour{ public Text CreditMainText; public void PopCredit(){ CreditMainText.rectTransform.localPosition = new Vector3(0f,-200f,0f); } } スク…
オフセットの部分は、ベクトルで考えるとわかりやすい。 using UnityEngine; using System.Collections; public class PieceManager : MonoBehaviour { private bool isDrag = false; enum STEP{ NONE = -1, IDLE = 0, DRAGGING, } // 初期状態 private STEP…
using UnityEngine; using System.Collections; public class CubeManager : MonoBehaviour { public static CubeManager instance = null; void Awake(){ if(instance = null){ instance = this; } } void Update () { if( this.gameObject == GameManager.…
「ブログで稼ぐ」は現実的か?PV別ブログ収益をざっくり計算blogos.com
A,B間の距離を計算してくれるプロパティ float型で値を返す。 // Bool型のメソッド。メソッドも返り血をBool型することもできる。 private bool is_in_snap_range() { bool ret = false; // ある程度離れていたとしても、trueとする。 if(Vector3.Distance(t…
originプロパティ:開始点 directionプロパティ:方向(単位ベクトル) public bool unproject_mouse_position(out Vector3 world_position, Vector3 mouse_position) { // returnでtrue、falseを返す。 // ret、ローカル変数にする。 bool ret; float depth…
Unity – 効果音(SE)を再生する方法。複数の音を鳴らすサンプルコードも用意しました | increment Logincrement-log.com
error CS1519: Unexpected symbol `void' in class, struct, or interface member declaration 「;」がないとか。 private float step_timer = 0.0f void Update () { }
コンポーネントを取得するとき、2通りの書き方がある。 public GameObject textlevel_ex; public text textlevel; textlevel = textlevel_ex.GetComponent<Text>(); public void TextLevel(string method){ if(method == "pop"){ ParentChance.SetActive(true); t</text>…
Table of Contents · Game Programming Patterns CASUAL CONNECT EDUCATION
Android アプリ開発に (UI) UI « Android GitHub - futurice/android-best-practices: Do's and Don'ts for Android development, by Futurice developers GitHub - futurice/ios-good-practices: Good ideas for iOS development, by Futurice developers. …
コード中に全角のスペースが入っている場合が多い。 (「;」がないとかの可能性もあり) 例1 error CS1525: Unexpected symbol `<internal>' 例2 error CS1525: Unexpected symbol `iTween' IEnumerator ButtonBombUnlockWait(){ yield return new WaitForSeconds(0.</internal>…
public static int CurrentScore; スコア、ハイスコアの保持(unityC#): おじさんのプログラミングojisan-puroguramu.seesaa.net
ハイスコアの作成は、Unity公式チュートリアルを参考にした。Unity: 統合ゲーム開発環境japan.unity3d.com using UnityEngine; using System.Collections; using UnityEngine.UI; // プレイ画面でのスコアの表示 public class Score : MonoBehaviour { publi…
ChromeのGoogleDriveを使ってURL作成を作成することで解決した。また、ビルドによって生成されたhtmlファイルとunity3dファイルフォルダごとアップロードするのも忘れず。 https://googledrive.com/host/0B60ZL9C7QgodfmxGdFZmN1M5VzlGb1hEd2xwa3BEZ1VuZk1Pa…
makers.hatenablog.com
アセット作家になろう! ~作ったキャラクターやスクリプトをアセットストアに出品しよう!~ from Takashi Jona www.slideshare.net
値が設定されていないことによるエラー。丁寧に調べてみると、その通り値が設定されていない...。 UnassignedReferenceException: The variable CurrentScoreTextGameOver of ScoreGameover has not been assigned. You probably need to assign the Current…
private void LoadAbilityTableFromJSON(string json) { JsonData jresult = JsonMapper.ToObject (json); List<Questions> data = new List<Questions> (); // JsonDataはカウントすることができる。 maxQuestion = jresult.Count; for(int i=0;i</questions></questions>
Resourcesにあるアセットは、 Resources.Load(“ファイルを選択”) で呼び出すことが可能である。だから、例えば、AudioClipを呼び出すとき、スクリプトに変数を作って呼び出さずに直接呼び出すこともできる! public void PlayQuestion(){ string assetLocati…