Hello, I am having trouble setting up a basic demo. I have created a new visual studio project to work in along side the sample projects. I have been able to change some of the graphical icons. However, not I want to load my own json file. However I have been completely unable to do this.
I placed the file in project/bin/data/models but no matter what path I use I cannot load any data.
I’m following this thread for using the api JSON loading example
JSONFile& antjson = JSONFile(context_);
JSONValue jsonArray = antjson.GetRoot();
But nothing is working, even the absolute path. What is going on?
The interesting thing is how this line ever compiles.
Objects are non-copyable.
The second interesting thing is where stored the object pointed by reference
antjson and why it doesn’t crash immediatelly.
I am attempting to use the resourceCache,
JSONFile* jsonFile = cache->GetResource<JSONFile>("ant.json");
JSONValue jsonArray = jsonFile->GetRoot();
int size = jsonArray.Size();
the file is placed in bin/data
but still no luck. This crashes when attempting to read antjson which returns null.
Is there a solid example on this to follow?
Check that resource cache internally has the same paths as you expect to see.
LoadFile must work with relative paths, resource cache will work with paths in cache dirs only.
It’s hard to guess the rootcause without logs, but it’s easy to debug. At least, check logs for errors.
Oh, it’s loaded the file but encountered a parsing error. I am not getting any output to the VS console, is there a way to turn that on?
Urho put logs into your document folder by default, check it.
TODO: Add optional logging to VS console
Where are the logs? I cannot find them.
I’m find Urho3d hard to work with.
JSON file won’t load, parser says it’s fine.
My default location is
Yes, it may be a bit hardcore.
Urho3D is fine if you treat is as C++ game framework and have enough skill in C++ developement.
It’s not ready-to-use blackbox solution like Unity despite some people actually do everything in scripts.
Could you attach the file? It actually could be some bug because JSONs are not widely used in Urho.
There is a build option URHO3D_WIN32_CONSOLE to show the log in an console window.