Skip to content

Instantly share code, notes, and snippets.

@cfazilleau
Last active July 15, 2022 19:09
Show Gist options
  • Save cfazilleau/3ebf7ff2dd83c50973f83a3a33fb34b6 to your computer and use it in GitHub Desktop.
Save cfazilleau/3ebf7ff2dd83c50973f83a3a33fb34b6 to your computer and use it in GitHub Desktop.
Simulate Unreal engine in Unity (just shows the "LIGHTING NEEDS TO BE REBUILT" in the top left corner of the viewport.) based on an original idea by Kenney (https://github.com/KenneyNL/Unreal-Simulator-for-Unity) but this time, it is just a 23 lines editor script, and not a full package with prefabs, assets, etc...
using UnityEngine;
using UnityEditor;
[InitializeOnLoad]
public class UnrealSimulator : Editor
{
private static GUIStyle style = null;
private const string text = "LIGHTING NEEDS TO BE REBUILT (4 unbuilt object(s))";
private const string subtext = "'DisableAllScreenMessages' to suppress";
static UnrealSimulator()
{
SceneView.duringSceneGui += (SceneView sceneview) =>
{
style ??= new GUIStyle(GUI.skin.label) { richText = true, fontSize = 13, font = Font.CreateDynamicFontFromOSFont("Verdana", 13) };
Handles.BeginGUI();
GUI.Label(new Rect(new Vector2(21, 21), new Vector2(Screen.width, 20)), "<color=#00000080>" + text + "</color>", style);
GUI.Label(new Rect(new Vector2(20, 20), new Vector2(Screen.width, 20)), "<color=#ff0000ff>" + text + "</color>", style);
GUI.Label(new Rect(new Vector2(60, 40), new Vector2(Screen.width, 20)), "<color=#8c8c8cff>" + subtext + "</color>", style);
Handles.EndGUI();
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment