Created
October 7, 2020 11:10
-
-
Save korchoon/eee2af72f0fba797891bc917cd6fff52 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
static RenderTexture TopDownPreview(GameObject prefab, RenderTexture rt, Camera Camera, Transform Root) { | |
var instance = Object.Instantiate(prefab, Root); | |
instance.hideFlags = HideFlags.DontSave; | |
Camera.targetTexture = rt; | |
Camera.Render(); | |
Object.DestroyImmediate(instance); | |
Camera.targetTexture = null; | |
return rt; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment