When I try to copy the "projectFolder\ProjectSettings\Physics2DSettings.asset"of a project to the Assets folder.
When used UnityEditor.AssetDatabase:Refresh().
The following warnings appear:
“You are trying to import an asset which contains a global game manager. This is not allowed.”
Is there any way to disable this warning?(Invalid attempt to use “#pragma warning disable”)
Why are you trying to copy the Physics2DSettings into Assets?
I need to merge multiple projects, so read all the settings for the project.
I need to copy Physics2dsettings to assets to load and read using Assetdatabase.
for example:
string physics2dAssetPath="..../Physics2DSettings.asset";
SerializedObject serializedObject=new SerializedObject(AssetDatabase.LoadAllAssetsAtPath(physics2dAssetPath));
var it=serializedObject.GetIterator();
while (it.Next(true)){
string itName=it.name;
if(itName=="m_Gravity"){
//read to gravity
}
}
You should be able to just do AssetDatabase.LoadAssetAtPath<Object>("ProjectSettings/Physics2DSettings.asset"); without copying anything
Thank
It is possible to read only the settings of the current project, but not the external project
Copy the asset into the ProjectSettings with a temporary name and read that.
It’s been tried
Settings files are YAML. You can read it in as YAML and parse it directly yourself.
Thank.
I use YamlDotNet parsing to achieve the expected results.
https://assetstore.unity.com/packages/tools/integration/yamldotnet-for-unity-36292
I have done all the work with AssetDataBase.
Fk.