Created
July 24, 2019 00:08
-
-
Save takashi1975/fbd3279907a9a0b568a0d3e18e24594e to your computer and use it in GitHub Desktop.
Unity DrawLine multi (いったん描画したら機能停止させる)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class DrawLineManager : MonoBehaviour | |
{ | |
[field: SerializeField] | |
public GameObject prefabDrawLine { get; private set; } | |
[field: SerializeField] | |
public GameObject currentDrawLine { get; private set; } | |
void Start() { | |
this.currentDrawLine = Instantiate(this.prefabDrawLine, this.transform); | |
} | |
void Update() | |
{ | |
if (Input.GetMouseButtonUp(0)) { | |
//描画機能停止 | |
if (this.currentDrawLine != null) { | |
this.currentDrawLine.GetComponent<DrawLine>().enabled = false; | |
} | |
this.currentDrawLine = Instantiate(this.prefabDrawLine, this.transform); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment