Created
February 28, 2017 10:49
-
-
Save Koroeskohr/9acbb1d0049cd54ff076e3634fd7e9b1 to your computer and use it in GitHub Desktop.
Instantiate object in scene Unity (GUI)
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
var canvas3D = FindCanvas3D(); | |
if (canvas3D == null) throw new System.Exception(TODO); | |
var gizmo = Instantiate(Resources.Load<GameObject>("GizmoLine")); | |
gizmo.transform.SetParent(canvas3D.transform); | |
gizmo.transform.localScale = TODO; | |
static Canvas FindCanvas3D() { | |
var canvas = FindObjectsOfType<Canvas>(); | |
foreach (var c in canvas) { | |
if (c.name == "Canvas3D") return c; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment