c# Application to create Unity Package - c#

I want to make a Windows Desktop App in c#, that a user can drag and drop files (models, textures, materials) onto, which then bundles these assets into a Unity Package.
Can this be done from outside Unity using .Net, or can it only be done with Unity's own editor? If so, what NuGet package would be used as there are many Unity packages?
Many thanks.

If I understand your question correctly you wouldn't need an app for this.
Unitpackages can afaik only be created using Unity.
Unity has Command Line Arguments which allow you to export packages via a cmd call afaik like e.g.
C:Path\To\Unity.exe" -quit -batchmode -nographics -projectPath "C:Path\To\A\Unity\Project" -exportPackage "Assets" "C:Path\To\Export\File.unitypackage"

I don't know why you want that, but you can simply put the files you want into a folder as you wish and then convert to a zip file for easy transport internet if that is what you wish. I dont see the point in making a Unity Package for that.

Related

Multiple script and namespace errors on a previously working Unity project . Type or namespace name 'GUIColorOverride' could not be found

I had some unusual errors on a relatively small Unity project with six c# scripts written in Visual Studio. It was all working fine, and I came back to it after the weekend. Upon opening, there were 18 new errors which were preventing the code from compiling and I spent several hours trying to figure out what was going on.
The main errors were saying things like Type or namespace name 'GUIColorOverride' could not be found and associated script cannot be loaded, assign a valid script, even though they were linked and I could see the scripts had no errors in Visual Studio. I even did a full Unity uninstall and rebooted, then a clean install. This didn't fix it.
I tried a number of other things such as backing up the scripts from the assets folder and then deleting them. Opening the project and pasting them back in as 'clean' new scripts. This didn't work. I am using Unity's Cloud Collab so was even able to use this to go back to earlier pushes of the project (which had all worked). Nope.
Solved it! The issue was that the local Projects folder I had been using was connected to Google Backup and Sync. This messed with some of the files in some of the folders in PackageCache in Particular in the MyProject > Library > PackageCache > com.unity.timeline#1.2.13 > Editor > directory.
[FIX] To fix and prevent this from happening in future, I turned off Google Backup and Sync for my Unity Project(s), and am now exclusively using Unity Collab and Git. Using the specific errors that were showing in the Unity console, I located the exact path of the Unity-created files that were causing these errors in my broken project, and replaced them with the same files from a working project. This fixed all of the errors. There must have been some corrupted or partially synced files in these folders which caused Unity to have a tantrum. Hope that helps someone!
You should exclude these from the Backup!
Basically you can exclude anything that would also be excluded from git via e.g. this "official" .gitignore file for Unity projects.
Any file and folder listed here will be regenerated by Unity automatically and should not appear in any version control / Backup.
The entire Library folder in particular is part of it since its content changes quite rapidly and is recompiled every time you change a script, install/remove a package etc.
Checkout Unity Manual - Behind the Scenes for more information in detail
When backing up a project, or adding a project to a Version Control Repository, you should include the main Unity project folder, containing both the Assets
and ProjectSettings folders. All the information in these folders is crucial to the way Unity works. You should omit the Library and Temp folders for backup purposes.
To solve an already present issue with the Library folder you can most of the times fix it by simply closing Unity, deleting the entire Library folder via your file browser and opnening Unity again → Unity will rebuild the Library

Unity3D sqlite multiple "System.Data.dll" problem

I am trying to use sql-lite in my Unity3D project. In fact, I used it in the past now I am trying to update it.
Unity version and sql-lite version has changed since then.
Now I get an error like this;
error CS1703: Multiple assemblies with equivalent identity have been
imported: 'C:\Users[username]\Documents\Unity Games[your program
name]\Assets\System.Data.dll' and 'C:\Program
Files\Unity\Editor\Data\NetStandard\compat\2.0.0\shims\netfx\System.Data.dll'.
Remove one of the duplicate references.
As I understand from the message that, sqlite wants to use its own System.Data.dll file, but it has the same library name in .net. So this causes a conflict and unity throws an error.
I tried to delete the System.Data.dll and its meta filewhich is in Assets file, but did not work. I also tried to change the file name in Asset folder but nothing changed...
Do you have a solution for this problem? I have tried in both Unity 2018 and 2019 versions.
Additional info may help others: In the past I had a problem with sqlite in my games. I had handled the situation like putting or copying my data sqlite file (filename.sqlite as an example) into the folder:
C:\Users[username]\AppData\LocalLow\[app folder]\[app
name]\filename.sqlite
Because unity looks for the folder in script and that folder exists in windows which I mentioned above;
string filepath = Application.persistentDataPath + "/" +
"filename.sqlite";
This helped me to solve my problem in the past. Now I am stuck with a different problem...
Solution:
Here is the solution by the guied of Алексей Кудряшов and blending my sqlite package. Thanks to him for his suggestion.
1- I deleted all all Plugins, GoogleMobileAds, PlayServicesResolver etc.
2- I first installed my admob package back
3- I installed everything manually in the link;
SQLite4Unity
4- I installed sqlite package but while installing it, I select none and i installed only "Mono.Data.Sqlite" file. If you have it or if you find it you can manually add it into Asset folder of Unity3D. Also you may find it from;
SQLite web page
5- Then Console said me that there is a conflict in x86 and x64 folders for sqlite3.dll file so, I clicked the x86 folder, then clicked sqlite3.dll then in the inspector panel I disabled everything.
6- Then I imported "using SQLite4Unity3d;" for my data script.
7- I also imported "using Mono.Data.Sqlite;"
8- Then everything worked well.
Did you try to use another SQLite wrapper?
e.g. SQLite for unity
You can just remove your current SQLite plugin and replace it with this one.
Don't forget to re-launch unity and unity HUB, cuz unity will keep DLLs in the memory until it restarts.

How to make a setup for c# app that uses a vbscript copying a file from LAN?

So i Have this c# application that contains a button allowing a file copy from a network share folder.i use a vbscript to copy the file, this script takes the source and destination path.now i want to create a setup to install my application on any PC connected to the LAN. the thing is the path will eventually change so i'm not sure if it will work.
I never made a setup before and i'm wondering if there is a way to customise the setup to allow the installer to make the changes.otherwise any solution will be very helpfull. thank you
I don't normally like giving answers that are mostly links, but it is too much to post here. Here is a quick summary:
There are quite a few things that can do what you are asking.
The one I like is called Squirrel. I recently had to learn how to use it while deploying an application for my company.
The steps in a nutshell(see what I did there? :)
Build your application (optionally add the update checker code
first - see links for details)
Package your application into a .nuget file using Nuget Package Explorer(details in links below)
Run the squirrel --releasify on your nuget
It will output the setup files that you are looking for in the Releases directory.
More information (that you will likely need):
Github - Squirrel.Windows
Youtube - Video tutorial that I found helpful
Github - Squirrel Getting started guide
As for your vbscript, I would do the file copy inside C#. You are very likely to run into permissions issues when using vbs. In any case, why add the complexity of 2 different languages when C# can do a file copy easily.
Something like this during your application's startup.
if (File.Exists(localFileName) == false) // check to see if the file is needed
{
File.Copy(sourceFileOnLan, destinationFile); // get the file
}
If you are really set on using a vbs file, you can launch it using Process.Start() and let Windows execute it.
Also, you can store the paths in your app.config file, and update them if/when they change.

Can I run BuildPipeline.BuildAssetBundles in playmode?

Hi everyone I need a help with Unity. I need to run the method 'BuildPipeline.BuildAssetBundles' after I click a button while i'm using the built software, is it possible to do? I know that this is an editor script, but is there a way to call it in a 'non-editor script?
Thanks at all
No classes that are part of the UnityEditor namespace will work in a build. Unity will simply refuse to try to do it. You can use things from AssetBundle because it's a part of UnityEngine, but you can't use BuildPipeline in a build. Unity allows the UnityEditor namespace to be include only in files that are marked as being editor files, usually by being placed in folders called "Editor" and those files are excluded from the build.
You can use BuildPipeline in playmode inside of Unity Editor's player though, but that's about it.

Removing ARToolkit nft marker from Android build

when i start the sampleNFT -an already made example from ARToolkit- in unity Editor -pressing play button- it worked greatly
BUT when i build my android app it removes my NFT marker which is in this case "gilbratar"
and i made the player setting and Android manifest as good as it supposed to be !
BTW i'm using Unity 5.3.0f4 and ARToolkit 5.3.1
why i have this problem ?!
check this image for more info
You're posting Unity editor logs, but saying you're building to Android. Do you mean you're trying to hit the "Play" button while your build target is set to Android?
If that is the case, I would recommend continuing on the editor set to your desktop platform for debugging purposes, and only switching over to your build target for building.
Also, make sure that the AndroidManifest.xml in your Assets/Plugins/Android folder has it's package name changed from "com.Artoolkit.demo" to whatever you chose as your Bundle Identifier under build settings for Android.

Categories

Resources