#Debug.Log not Working
1 messages · Page 1 of 1 (latest)
Was there much u changed from these?
https://pastebin.com/GWfcx07j
https://pastebin.com/fFcFD5w5
https://pastebin.com/gUpRAvU2
If that debug isnt running, first assumption is that you dont have the script on an active game object
For god's sake
I literally do not think I changed anything and it worked
I tried re-editing and saving and reloading that code 3 times 😂
Oh well, at least it's working. I guess this thread turned out to be super useful haha
But interestingly it's printing twice
probably just have it on 2 gameobjects
No, it's just this one
Start only runs once, search your scene with t:DecodeButton to see if anything else has it
once per script, either theres 2 scripts or you have 2 debug logs
Just one
And VS22 says that Debug.Log only appears once in all the scripts
Wait
Did I instantiate the script twice?
hm that looks like 2 right there, though honestly im not sure what that search is from lol i just meant the hierarchy here.
Haha yeah, but doing even this results in nothing showing up
u gotta search the full name, t:ScriptName will search for any objects that have the component
that would mean u dont have the script attached to a game object at all
are u adding it to an object through some other code?
that is a gameobject, the entire thing is
actually just do this instead on start, which will print for things instantiated later
Debug.Log($"DecodeButton on {name}");
And what will name be?
idk maybe a typo or something
name is already a field which will print the name of the gameobject
Yes it was
That worked
It was because I did t:
Without that it worked fine
Ok I fixed it
that part should've been fine
https://docs.unity3d.com/Packages/com.unity.quicksearch@2.1/manual/search-syntax.html
Searches all game objects who have a component containing the word collid (ex: Collider, Collider2d, MyCustomCollider).
np
also for the simulator, maybe look more into the settings or put the app on your phone to see if it can handle it. Im not entirely sure that you have to use an external file. I doubt the simulator really matches what real phones have
Quick question, if I were to store that massive array in a file, would it be a JSON file?
It supposedly accounts for real-life RAM, storage etc...
But I have not reached the stage of getting it onto my phone
And that seems like a very complicated process
you could, json is just a format. If this is the only thing you're gonna be storing then id just put it in a txt and loop over each line lol
But if I need to I will. However I'll hardly be using that array so I've no problem storing it externally
Can I just put it in my Assets folder instead of all that stuff about local phone files?
It can exist in your files yea, but you'll still need to google how to read files for android. The thing I linked u before is simply just a way of getting a filepath
you wont be able to read the file the normal c# way, i believe because its not just sitting there as a .txt file. not sure how unity really builds the app but its packed in there somewhere
private void TxtToList(List<string> list, string path)
{
StreamReader reader = new StreamReader(path, Encoding.UTF8);
while (reader.Peek() >= 0)
{
list.Add(reader.ReadLine());
}
reader.Close();
}
that is the normal c# way, which shouldnt work for android
This works in Unity but not in Android because the file is packed inside the APK, but surely that won't matter as the file isn't needed for installation/APK unpacking?
when u build the project, it wont work
if you're running all of this from your pc (for like a school demo) then it shouldnt matter what you do
I intend on getting it working on my phone
So I will figure it out
unitywebrequest looks completely unrelated
All about HTTP comms
also if memory was an issue before just having it in an array, you might not want to add them to a list either since itll be stored
unity web request doesnt have to be for online files
Correct me if I'm wrong, but I can just store each word temporarily while I loop over the external file and then replace that variable's values with the next word? Definitely slower but that means I'm storing no more than a single word
All the methods are to do with URLs and stuff, can offline files have URLs? I wouldn't have thought so
yea thats better, the example u posted above adds them all to a list
its not a url but you just use file: at the start. at least from what i see online
Ohhh the same way that files viewed in browsers have this: file:///D:/VATSIM/London%20TMA.pdf
First PDF I could find 😄
oh yea I forgot thats what it shows in browsers too
Could you let me know what you think about that? Then I can get back to it tomorrow. Thanks mate!
from what i saw online, you can use Resources, unitywebrequest (for local files easily), or TextAsset but i dont know shit about that last one tbh
Oh one last thing, the unity profiler also tells you about memory. You should probably use that to see how much the strings were really allocating.