paxkidz.blogg.se

Unity default resources extract
Unity default resources extract







I just want to access the built-in sprites that are already packaged in the build. This is the current way I am already doing it. I do not want to use a prefab or public variable to do this which requires doing stuff manually first. How can one access these build-in sprites in a standalone build instead of the Editor? Tried typeof(Sprite) instead of typeof(UnityEngine.Object) but that failed too. UnityEngine.Object img = Resources.GetBuiltinResource(typeof(UnityEngine.Object), "UI/Skin/InputFieldBackground.psd") I tried to use Resources.GetBuiltinResource for the build and standalone but it always returns null. Unfortunately, AssetDatabase.GetBuiltinExtraResource is from the UnityEditor namespace and will not work in a build or standalone program. In the Editor I was able to retrieve them with the GetBuiltinExtraResource function: Sprite img = ("UI/Skin/InputFieldBackground.psd") Private const string kMaskPath = "UI/Skin/UIMask.psd" Private const string kDropdownArrowPath = "UI/Skin/DropdownArrow.psd" Private const string kCheckmarkPath = "UI/Skin/Checkmark.psd" Private const string kKnobPath = "UI/Skin/Knob.psd"

unity default resources extract

Private const string kInputFieldBackgroundPath = "UI/Skin/InputFieldBackground.psd" Private const string kBackgroundSpritePath = "UI/Skin/Background.psd"

unity default resources extract

private const string kStandardSpritePath = "UI/Skin/UISprite.psd"

unity default resources extract

I dug deep in the UI source code and found all their location declared in the MenuOptions.cs script. I want to access these through code.These include the UISprite, UIMask, Knob, Background and others as circled in the screenshot below. There are about 7 Sprites included in Unity that are used when you create a UI.









Unity default resources extract