Is there any way to recover my Asset in Unity? - unity3d

My Asset is gone for some reason. It said I have no assets in the package manager even though the last time I use Unity, it still has a lot of assets normally. I checked my asset store and it said I have no asset too. But when I tried adding the asset I have before it wouldn't add. Weird? If you know how to fix this problem please tell me.

There are several things that could cause your assets to disappear in Unity. Here are a few possible explanations:
You may have accidentally deleted the assets from your project. You can check to see if the assets are still in your project's "Assets" folder.
You may have moved or deleted the assets outside of Unity. This could cause Unity to lose track of the assets, as it relies on the file path to locate them.
There may be a problem with your Unity project file. If the project file is damaged, it could cause assets to disappear or become inaccessible.
To fix the issue, you could try the following:
Check to see if the assets are still in your "Assets" folder. If you find them there, you can try reimporting them into your project.
If you can't find the assets in your "Assets" folder, try searching your computer for the missing assets. If you find them, you can move them back into the "Assets" folder and try reimporting them into your project.
If you are still unable to locate the missing assets, you may need to create a new Unity project and import the assets into the new project.

Related

Re-generating assets for Flame Game with Very Good Ventures template

So I'm building a Flame Game, and I found this template (the actual code that comes with the template is here) made by Very Good Ventures (it's the one used in the Pinball project made for Google I/O).
I'm just writing my code, and added my assets in the assets/ folder, so far I only need images so I deleted all the other assets that came with the template and the unnecessary folders. Thing is, I don't know how to re-generate the gen/assets.gen.dart file to reflect the changes I've made to the assets/ directory. I've tried running my app but I obviously get an error because the assets I'm trying to load are not defined.
I tried to look up what command is needed to regenerate the assets file, and most solutions I found included this line of code which requires the build_runner, flutter_gen and flutter_gen_runner dependencies.
Now, I don't mind adding new libraries if necessary, but if they are needed, shouldn't those be in the pubspec.yaml of the template to begin with? I even checked the Pinball project repo to see if they had to add those dependencies and their pubspec.yaml does not include any of the runners or flutter_gen.
Anyway, I still tried adding the libraries and running the command flutter packages pub run build_runner build, which manages to regenerate the assets.gen.dart file to include my images and delete unnecessary directories but I still get an error.
When I do
loadSprite(Assets.images.ramp.path);
(just like they do in the VGV template), I get a red screen error because apparently Assets.images.ramp.path gets evaluated to assets/images/assets/images/ramp.png (there's an extra assets/images/).
After checking the assets.gen.dart file it seems like the VGV template creates the class AssetGenImage extends AssetImage while the flutter packages ... command creates an AssetGenImage that doesn't extend AssetImage.
I'm pretty sure I'm missing something here, because both the VGV template and the I/O pinball project manage to regenerate the assets files without issue. I just don't really know what I'm supposed to be doing.
(just in case, I have not changed anything else in the pubspec.yaml apart from removing the lines that pointed to the other assets directories I didn't need like assets/audio/ and adding the 3 new dependencies)
so you are probably getting this error because Flame by default adds a the assets/images/ prefix path on its image loading code.
That is why on your error, you are seeing that part duplicated.
To properly use flutter gen, which generates the full path of the assets, you can simply "clear that prefix", which you can do just by doing so on your game class, you can do this as the first line of your onLoad method
images.prefix = '';

Unity project folders missing

i found an old unity project but the "standard project folders" such as
"ProjectSettings"
"UserSettings"
"Packages"
ecc.
are missing.
here it is the folder screenshot
the only folder that i have is "Assets". is there a way to find the missing folders?
maybe they are stored somewhere else in the disk and linked to the project? (i don't know if it's possible)
the project in this state is corrupted and not usable, is it possible to fix it?
Try creating a new project, and replacing the "Assets" folder of the old project with that of the newly created project.
Unity has changed the structures of its projects over the years, so it is normal that after many years you cannot open it.
When you open the project with the old "Assets" folder, remember that you will have many errors to solve: you will have to add all the packages you entered, and modify the opsoleto code.
I checked the folder further, and saw that there are actually no normal assets such as scripts, images or audio in the "Assets" folder. Without those you can't get it back.
I am sorry.
I write another answer because the first one is valid for all cases where the "Assets" folder is intact.
You can decide which one looks best for you.

Null reference exception in Unity after renaming folder

After foolishly renaming a folder containing a bunch of assets, my textures started rendering pink and I got a bunch of null reference exception errors. I renamed the folder back to it's original name so that everything should now be in the right place, however I am still getting the null reference errors. Does anyone know how to fix this?
I'm assuming the renaming of the folder happened when Unity was closed, correct? If you don't use version control (Git, Perforce, etc.) you are pretty much in a bad spot. You will have to setup your references again.
The problem is the following:
Unity gives every asset and every folder a specific ID. All references in your assets, use those IDs to find out what is what. That is, which material was assigned to your objects, which textures were on those materials, which components were on an object, and so on.
Now you close Unity, change you folder name, and Unity goes "oooh, new folder, let's give that an ID, and all the assets in it as well. Oh, and I know about one folder which seems to have been deleted, so let's get rid of all my knowledge about it".
Panic ensues, and you give your folder the old name again. But given that stuff was referenced by ID and not name ... well, you end up in your current state.
In conclusion:
Make sure to always rename and reorganize inside Unity if you wish to do so.
If you can't revert to old commits, or if you don't use version control at all, you're going to have to set up the assets again.

A weird phenomenon in Ember-CLI dist/, I cannot modify anything inside it

In my Ember-cli project, I put some static assets, such as images and icons into the /dist/static/image directory. Then I build the project (I forgot the details in this part).
Then when I tried to modified some picture inside that folder (I wanted to change some parts to be transparent), I found that I cannot change anything inside.
For example, when I used a new pic to replace the old one, and then I run ember, I found that the new pic was replaced by the old one automatically.
I am not so sure about the internal mechanism, and I tried to use git, but that didn’t help.
/dist is just that - it gets wiped out on each build and reloaded with the distributable files. What you are looking for is /public

Organise my project folder

It's a terrible mess in my project folder (not in xcode, where all is clean, but on the desktop folder).
How can I organize this folder without killing all xcode references ? I just tried, but all the links broke.
Thanks,
What I'm used to do in this case is:
Organize everything in my finder folders, don't mind the red missing files in xcode. If you are using svn, make sure you use its commands to do this.
Then I go to each file in XCode marked red and redefine its Location using the right pane Utilities tab (xcode 4) or its file properties(cmd+i in xcode 3).
Clean and build to make sure everything is OK.
To avoid this, I got used to organize my project each time I create a new file/folder. I first create the folder physically and then add it to xcode, later I create the files.
I don't know a simpler way of doing this.
Hope it helps,
I've been there myself :) You do need to remove and add back in the files that need organizing , but it can be safely done. Here's what I'd normally do;
Remove the files / folders you need to organize from within your XCode project (this is safe, you can add them back, no worries) ONLY DELETE THE REFERENCES when asked. Do NOT Trash them.
Close XCode
In your desktop folder, now arrange and organize your files and folders as needed.
Open up your XCode again, and open your project. Now, re-add your now well-organized files and folders back into the XCode project. Copy them into to your folder if you happen to be adding anything from outside the desktop folder.
Now, your project will be well organized both in and outside.