Comments (5)
Also wanted to mention that ( in case it would help )
that my Calculate () in Custom Node is just returning true
public override bool Calculate () {
return true;
}
from node_editor_framework.
Thanks for the feedback:)
I found that the file path preparation (that makes your input compatible with either AssetDatabase or Resources) and actual loading are inconsistent - the one uses AssetDatabase in playmode, the other Resources. But in a built, it should work.
So, please open ResourceManager.cs in Utility and check if replacing these first three functions works:
#region Common Resource Loading
/// <summary>
/// Prepares the path; At Runtime, it will return path relative to Resources, in editor, it will return the assets relative to Assets. Takes any path.
/// </summary>
public static string PreparePath (string path)
{
path = path.Replace (Application.dataPath, "Assets");
#if UNITY_EDITOR
if (!Application.isPlaying)
{
if (!path.StartsWith ("Assets/"))
path = _ResourcePath + path;
return path;
}
#endif
if (path.Contains ("Resources"))
path = path.Substring (path.LastIndexOf ("Resources") + 10);
return path.Substring (0, path.LastIndexOf ('.'));
}
/// <summary>
/// Loads a resource in the resources folder in both the editor and at runtime.
/// Path can be global, relative to the assets folder or, if used at runtime only, any subfolder, but has to be in a Resource folder to be loaded at runtime
/// </summary>
public static T[] LoadResources<T> (string path) where T : UnityEngine.Object
{
path = PreparePath (path);
#if UNITY_EDITOR // In the editor
if (!Application.isPlaying)
return UnityEditor.AssetDatabase.LoadAllAssetsAtPath (path).OfType<T> ().ToArray ();
#endif
throw new NotImplementedException ("Currently it is not possible to load subAssets at runtime!");
// return UnityEngine.Resources.LoadAll<T> (path);
}
/// <summary>
/// Loads a resource in the resources folder in both the editor and at runtime
/// Path can be global, relative to the assets folder or, if used at runtime only, any subfolder, but has to be in a Resource folder to be loaded at runtime
/// </summary>
public static T LoadResource<T> (string path) where T : UnityEngine.Object
{
path = PreparePath (path);
#if UNITY_EDITOR // In the editor
if (!Application.isPlaying)
return UnityEditor.AssetDatabase.LoadAssetAtPath<T> (path);
#endif
return UnityEngine.Resources.Load<T> (path);
}
#endregion
Also, loading EditorStates will not work either, as currently they have to be fetched from the subAssets of the file and these are not accessible through Resources:/
Seneral
from node_editor_framework.
Thanks for your response,
Hmmmm,
I am not sure,But now both Built version and Play in Editor raise the exception :
throw new NotImplementedException ("Currently it is not possible to load subAssets at runtime!");
I think that is what you want to say, I can't use the Nodes in Runtime ?
I am really sorry, But I am totally confused, because I thought that the CanvasNode is ready to be used in Runtime.
Please excuse my ignorance, but if it is not available in run-time
Then it is still in experiment phase ?
( i.e. I can't use it's results yet in game logic ,, true ? )
Thanks
from node_editor_framework.
You can use it, but whatever method your using, you can't yet load editor states. So you need to make sure nothing will trigger Resources.LoadResources ;) Because that requires subAssets to work and this is not possible at runtime...
It is possible to fix that by simply make the canvas reference the editor states, because the canvas is easily retrievable as it's the main asset in the file.
from node_editor_framework.
This is fixed in the newest commit 23c875b to the develop branch:)
Please read notes, they will tell you what works and what not at runtime!
from node_editor_framework.
Related Issues (20)
- The connections will miss when I add a new node. HOT 2
- GUIScaleUtility.cs Init Method NullReferenceException in Unity 2019.1.2f1 HOT 10
- Insane Bug from using RTEditorGUI.EnumPopup() HOT 3
- XML not saving node values HOT 10
- Is Project Active and Package Support? HOT 15
- `PlayModeStateChange' could not be found. Are you missing a using directive or an assembly reference? HOT 3
- [Solved] Context menu not showing up. HOT 2
- Multiple instances of node editors open at once HOT 1
- Toolbar is not showing up HOT 4
- All data is lost when I change the scene, even though I have extra saved as an asset file HOT 4
- How to input multiple outputs to a node? HOT 8
- Apple M1 computers not displaying Bezier curves HOT 3
- Added one node. Then it stoped working. (Remove the node, re-install, sitll not working) Unity 2020.2 LTS
- Implementation of a Logic Graph HOT 7
- XML import issue on UWP
- I deleted the ScriptableObjects in Assets/DefaultEditorResources/Node_Editor_Framework HOT 3
- Making children of node drag along with parent HOT 5
- Functional Nodes that are not tied to the Node Editor Window HOT 6
- Loading canvas based on Selection.activeTransform? HOT 4
- seems undo pro doesnt work with unity 2022.2.8 not sure what version it stopped working at HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node_editor_framework.