Hi All,
I need to change materials on objects between levels. The materials are stored in a folder called levels/level# ect. I use the level number for all objects ect on a level eg level1, level2 ect.
So to load I’m using
sym.characrter_material = ( Material )AssetDatabase.LoadAssetAtPath( material_name, typeof( Material ) );
which works. However my only worry is it uses
using UnityEditor;
is it OK to use this in a build game?
I’ve seen using Resources.Load, however this means breaking the “tidiness” of my directory hierarchy.
No, you can’t use UnityEditor in a standalone build.
You can use Resources and still use your hierarchy if you want, you just have to put those folders under a folder named Resources. The Resource.Load documentation discusses paths.