Unity show post build data in game - c#

I am trying to show post/pre build data to user in the unity game, something I want to update whenever I process a build. turns out in unity, the updated file version after pre or post build is not included in assets. It still fetches the data before pre/post build script.
Can someone help me resolve this issue.

run prebuild script and call AssetDatabase.Refresh()

Related

c# Application to create Unity Package

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.

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

Unity Google Play License Verification (LVL)

I am trying to implement License verification into my android unity game. I found this plugin, but the problem is that I am doing this for the first time and don't really know what to do.
I imported that into my project and attached CheckLVLButton.cs
to a gameObject in my scene and inserted my public LVL key to the script.
I have even recompiled the Java source and attached the new classes_jar.txt to the CheckLVLButton script, but I am still getting this error. This is the output of the log
And when I try to debug it on Android using Visual Studio, there is an error that ServiceBinder is null.
But when I try to run the game and push that button it just says Invalid LVL key! Check the source... But I have it right.
Do I have to do something else?
Do I have to install it from google play beta test instead of building apk with unity and installing?
You have to put it up in a test track, install it from the Playstore, and then test it. (it's a pain, and I am still not there yet.)
The reason that it is saying that it is invalid is because it's not installed from the playstore.

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.

Load serverside c# scripts and then attach a scripts to game object

I have Two question.
1. How can I load existing c# scripts from external path to my apk file.
2. How can I attach scripts in a game object.
Assuming that I create a sphere and then build an apk file. when i run my unity app, you can see the sphere,which is not moving. After building apk file, i'd like to move the sphere .
Scripts are compiled objects, so I believe you can't load them in dynamically. In addition, I believe Android wouldn't allow it anyway, as loading scripts in dynamically is considered a security risk. You could download an app, which downloads new virus-type scripts that weren't in the original code...
you can attach C# script to game object and disable it(unchecked), and after build apk file you can enable it by a button in run time,

Categories

Resources