NiloToon 같이 만들어 보고 싶어서 NiloToon 공개 소스를 참조한 URPSimpleGenshin Shader를 좀 개조해서 기능 추가 해봄.
// Based on SimpleGenshinFacial shader // Simplified NiloToon Shader for Unity URP
/* CustomURPToon Shader - A simplified toon shader based on SimpleGenshinFacial Features: - Basic toon lighting with cel shading - Rim lighting - Outline rendering - Face shadow mapping support - Mobile optimized */
Unity automatically defines certain symbols based on the authoring and build target platform. These are as follows:
DefineFunction
UNITY_EDITOR
Scripting symbol to call Unity Editorscripts from your game code.
UNITY_EDITOR_WIN
Scripting symbol for Editor code on Windows.
UNITY_EDITOR_OSX
Scripting symbol for Editor code in macOS.
UNITY_EDITOR_LINUX
Scripting symbol for Editor code on Linux.
UNITY_EMBEDDED_LINUX
Scripting symbol for embedded Linux.
UNITY_QNX
Scripting symbol for QNX.
UNITY_STANDALONE_OSX
Scripting symbol to compile or execute code specifically for macOS (including Universal, PPC and Intel architectures).
UNITY_STANDALONE_WIN
Scripting symbol for compiling/executing code specifically for Windows standalone applications.
UNITY_STANDALONE_LINUX
Scripting symbol for compiling/executing code specifically for Linux standalone applications.
UNITY_STANDALONE
Scripting symbol for compiling/executing code for any standalone platform (Mac OS X, Windows or Linux).
UNITY_SERVER
Scripting symbol for compiling/executing code for adedicated server(macOS, Windows or Linux).
UNITY_IOS
Scripting symbol for compiling/executing code for the iOS platform.
UNITY_ANDROID
Scripting symbol for the Android platform.
UNITY_TVOS
Scripting symbol for the Apple TV platform.
UNITY_VISIONOS
Scripting symbol for the VisionOS platform.
UNITY_WSA
Scripting symbol for Universal Windows Platform.
UNITY_WSA_10_0
Scripting symbol for Universal Windows Platform.
UNITY_WEBGL
Scripting symbol for Web.
UNITY_FACEBOOK_INSTANT_GAMES
Scripting symbol for the Facebook Instant Games platform.
UNITY_ANALYTICS
Scripting symbol for calling UnityAnalytics methods from your game code.
UNITY_ASSERTIONS
Scripting symbol for assertions control process.
UNITY_64
Scripting symbol for 64-bit platforms. In practice thisshould not be usedbecause it does not work on all 64-bit architectures and different CPU architectures on a given platform can share the same compiled assemblies. To execute code conditionally based on architecture, use a standardifstatement that checksIntPtr.Size, which is4in a 32-bit process and8in a 64-bit process. For an example, refer toAlternatives to directives.
Unity Editor version symbols
Unity automatically defines certain scripting symbols based on the version of the Unity Editor that you’re currently using.
Given a version numberX.Y.Z(for example, 6000.0.33), Unity exposes three global scripting symbols in the following formats:UNITY_X,UNITY_X_YandUNITY_X_Y_Z.
Here is an example of scripting symbols exposed in Unity 6000.0.33:
DefineFunction
UNITY_6000
Scripting symbol for the release version of Unity 6, exposed in every 6000.Y.Z release.
UNITY_6000_0
Scripting symbol for the major version of Unity 6.0, exposed in every 6000.0.Z release.
UNITY_6000_0_33
Scripting symbol for the minor version of Unity 6000.0.33.
You can also compile code selectively based on the earliest version of Unity required to compile or execute a section of code snippet. Following the same version format describd previously (X.Y), Unity exposes one global#definein the formatUNITY_X_Y_OR_NEWER(for example,UNITY_6000_0_OR_NEWER), that you can use for this purpose.
Other symbols
The other symbols Unity defines are:
DefineFunction
CSHARP_7_3_OR_NEWER
Defined when building scripts with support for C# 7.3 or newer.
ENABLE_MONO
Scripting back end #define for Mono.
ENABLE_IL2CPP
Scripting back end #define forIL2CPP .
ENABLE_VR
Defined when the target build platform supportsVR . Doesn’t imply that VR is currently enabled or that the necessaryplug-ins and packages needed to support VR are installed.
NET_2_0
Defined when building scripts against .NET 2.0 API compatibility level on Mono and IL2CPP.
NET_2_0_SUBSET
Defined when building scripts against .NET 2.0 Subset API compatibility level on Mono and IL2CPP.
NET_LEGACY
Defined when building scripts against .NET 2.0 or .NET 2.0 Subset API compatibility level on Mono and IL2CPP.
NET_4_6
Defined when building scripts against .NET 4.x API compatibility level on Mono and IL2CPP.
NET_STANDARD_2_0
Defined when building scripts against .NET Standard 2.0 API compatibility level on Mono and IL2CPP.
NET_STANDARD_2_1
Defined when building scripts against .NET Standard 2.1 API compatibility level on Mono and IL2CPP.
NET_STANDARD
Defined when building scripts against .NET Standard 2.1 API compatibility level on Mono and IL2CPP.
NETSTANDARD2_1
Defined when building scripts against .NET Standard 2.1 API compatibility level on Mono and IL2CPP.
NETSTANDARD
Defined when building scripts against .NET Standard 2.1 API compatibility level on Mono and IL2CPP.
Defined when the Input System package is enabled inPlayer Settings .
ENABLE_LEGACY_INPUT_MANAGER
Defined when the legacyInput Manager is enabled in Player Settings.
DEVELOPMENT_BUILD
Defined when your script is running in a Player which was built with theDevelopment Buildoption enabled.
This define only reflects whether the development build option was enabled at the time of the build. To know whether your script is running in the development build mode, useDebug.isDebugBuild.DEVELOPMENT_BUILDisn’t sufficient to determine whether you’re currently running in a development build because most platforms allow changing between development and non-development build without rebuilding the project. However, on some platforms, Unity doesn’t support switching between development and non-development builds in the Editor and requires you to switch after the build is complete. For example, on Windows, you can choose theCreate Visual Studio solutionoption to choose whether you want a development or non-development build in Visual Studio. Switching in Visual Studio doesn’t recompile your scripts and therefore, it will not reevaluate scripting defines. You can also switch from the final game build to a development build by swappingUnityPlayer.dllin the game build with the one from a development build for debugging live game builds.
Input 클래스를 사용하는 다른 스크립트 상에서 namespace 안쪽에 using UnityEngine; 이 정의되면,
Unity 자체 Input인 UnityEngine.Input이 우선시 되어서 아래 Custom Input 클래스를 넣어도 제대로 작동하지 않는다.
이럴 땐 using UnityEngine; 정의를 namespace 밖으로 옮겨주자.
※ 아래 예제와 같이 using UnityEngine; 문만 밖으로 빼주면 된다.
/// 1. 에러 상황
namespace Ex
{
using UnityEngine; // namespace 안에 있음(X)
public class Test
{
void Update()
{
// UnityEngine.Input을 참조하면서 에러 발생
if (Input.GetKeyDown(KeyCode.Escape))
{
Application.Quit();
}
}
}
}
////////////////////////////////////////////////////
/// 2. 정상 동작
using UnityEngine; // namespace 밖에 있음(O)
namespace Ex
{
public class Test
{
void Update()
{
// 정상적으로 Custom Input 클래스를 참조 함.
if (Input.GetKeyDown(KeyCode.Escape))
{
Application.Quit();
}
}
}
}
----
Unity 6000.1.11f1
URP
InputSystem 1.14.1
NGUI 2025.07.01
----
Legacy Input System을 new Input System으로 변환하면서 기존 Third Party 에셋들이 기존 Legacy Input을 계속 사용하고 있어서(특히 NGUI)
에러나는 부분을 가능하면 손을 덜 대고 해결하기 위해서,
Legacy Input System을 New Input System으로 Wrapping하는 클래스를 만들었다.
(왠만한 건 다 Wrapping 한 것 같은데 혹시나 빠진게 있을수도 있다.)
Activate Input Handling을 New Input System으로 변경하고 아래 스크립트를 Plugins 폴더에 넣어주면 된다.