how’s it going with this scriptableObject script unity has on wiki only works inside the editor how can i change this script using resources to get it to deploy in build anyone out there who can help with this?
using UnityEngine;
using UnityEditor;
using System.IO;
public static class ScriptableObjectUtility
{
/// <summary>
// This makes it easy to create, name and place unique new ScriptableObject asset files.
/// </summary>
public static void CreateAsset<T> () where T : ScriptableObject
{
T asset = ScriptableObject.CreateInstance<T> ();
string path = AssetDatabase.GetAssetPath (Selection.activeObject);
if (path == "")
{
path = "Assets";
}
else if (Path.GetExtension (path) != "")
{
path = path.Replace (Path.GetFileName (AssetDatabase.GetAssetPath (Selection.activeObject)), "");
}
string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath (path + "/New " + typeof(T).ToString() + ".asset");
AssetDatabase.CreateAsset (asset, assetPathAndName);
AssetDatabase.SaveAssets ();
EditorUtility.FocusProjectWindow ();
Selection.activeObject = asset;
}
///////equipt for pc use///////////
/*[MenuItem("Assets/Create/Faction")]
public static void CreateAsset ()
{
ScriptableObjectUtility.CreateAsset<Faction> ();
}*/
}
sorry about that and i seen you in the other thread similar to this one, i seen this script on a youtube video which come from unity wiki documentation, this only work in the editor im looking to build a faction script that will be able to deploy when its time to build the project, in the game i have ten different factions and i want them to be able to interact with each other sort of like this http://www.youtube.com/watch?v=O8BMCQnjUe4&list=UUmN-7CEb_pxfcxIHdOyAHYg is what i want to begin with in my game then advance it further
a little more about the project; ten different factions and each user will fight over who runs the city, im looking to have it where each faction interact once the game has begun. so i came across that factions script and that person who made that video didnt explain everything good enough at least to where my level of skill can take that and customize it for what i need… so i still need help
a factions script was made using scriptable objects, i cant get it to build now because the ScriptableObjectsUtility script contains editor only lines of code, how can i make this interactive faction script work and deploy sorry if im having a hard time explaining
i don-t know how to make it work, i understand what i need and how i want it to work nut i don’t know how to implement it just yet, i have to further develop my coding skills… hey are you available for hire? i have a-lot complete already, thou some of my systems can be made better but i don’t have the level of skill yet
AH! This file (.cs) must be put inside a Editor folder. Create a folder, name it “Editor”, and put the script in it. Unity will skip the file when building.
thanks a lot i tested it a it ran perfect… also if you don’t mind how would i write in a .asset object to be a changeable in the inspector from another script… i.e.
var faction : GameObject; … i cant place a .asset object in that type of var, what would i make it…