Skip to content

Instantly share code, notes, and snippets.

@korchoon
Created October 7, 2020 11:10
Show Gist options
  • Save korchoon/eee2af72f0fba797891bc917cd6fff52 to your computer and use it in GitHub Desktop.
Save korchoon/eee2af72f0fba797891bc917cd6fff52 to your computer and use it in GitHub Desktop.
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