Quantcast
Channel: Tutorials – Unity Coding – Unity3D
Viewing all 58 articles
Browse latest View live

Probably Not Quite Accurate Judo-Wrestling Simulator’2022


Using OPEN AI GPT-3 API in Unity

$
0
0
short clip: testing open ai dll

Customize UnityHub colors

$
0
0

It seems to be common request to have light color theme as an option for the new unity 3.0 hub.. so, while unity is working on that(?), you can edit and customize the hub yourself!

Steps (New 06.03.2022, see comments for info that can edit index.html directly)
– Install 7zip : https://www.7-zip.org/download.html
– Install asar plugin for 7zip : https://www.tc4shell.com/en/7zip/asar/
– Install Notepad++ : https://notepad-plus-plus.org/downloads/
– Install JSTools for Notepad++ (to beautify js sources) : https://www.sunjw.us/jstool/npp/
– Open “app.asar” with 7zip from the hub folder, like “C:\Program Files\Unity Hub\resources”
– Unzip the asar somewhere
– Edit Builds/Renderer/index.html with notepad
– Paste new style tag inside <body></body>, after line “<script src=”index.js”></script> and just before </body>
– Take ready css style from andrews patcher: https://gitlab.com/GuitarBro/hub-patcher/-/blob/master/hub_patcher.py (*the style contents only, not full css string value with quotes, also here for easy copy: https://gist.github.com/unitycoder/13b5323728961dd812c648cb2cf21368 )
– Save index.html (this is your unpacked asar folder)
– Copy app.asar to other drive (as you cannot overwrite it inside program files from 7zip, unless its running as an admin)
– While 7zip has your copied asar package open, drag & drop the modified index.html into same folder inside the asar (build/renderer/index.html) to overwrite it
– Notice the app.asar date modified has changed (7zip has updated the package)
– Close hub completely
– Now copy app.asar over the original app.asar at hub installation directory *NOTE: take backup from original app.asar first!
– Run unity hub and enjoy your new colors!


Steps (Old steps, complicated way)
– Install 7zip : https://www.7-zip.org/download.html
– Install asar plugin for 7zip : https://www.tc4shell.com/en/7zip/asar/
– Install Notepad++ : https://notepad-plus-plus.org/downloads/
– Install JSTools for Notepad++ (to beautify js sources) : https://www.sunjw.us/jstool/npp/
– Open “app.asar” with 7zip from the hub folder, like “C:\Program Files\Unity Hub\resources”
– Unzip the asar somewhere
– Edit Builds/Renderer/index.js with notepad, and use Plugins/JSTool/JSFormat to beautify source *(search for #1a1a1a to modify the main color and look for those CSS strings & colors inside the code, look for the html, body in that string.
– Save index.js (this is your unpacked asar folder)
– Copy app.asar to other drive (you cannot overwrite it inside program files from 7zip, unless its running as an admin)
– While 7zip has your copied asar package open, drag & drop the modified index.js into same folder inside the asar (build/renderer/index.js) to overwrite it
– Notice the app.asar date modified has changed (7zip has updated the package)
– Close hub completely
– Now copy app.asar over the original app.asar at hub installation directory *NOTE: take backup from original app.asar first!
– Run unity hub and enjoy your new colors!

Ideas:
– modify the source so that it loads external CSS theme! Then you can easily edit those CSS styles outside hub and without unpacking asar..

New full style using Andrews patcher CSS
Insert custom CSS after script tag
OLD Image: search for css colors and tags, like html, body and modify those styles
OLD IMAGE: Quick test: replaced 2 main colors, would need to fix font color next..

LudumDare#50: Delay the inevitable

(Sources) Fog Of War – effect

(news) Nano Tech for Unity

Testing Connected Component Labeling

Unity Stable Diffusion plugin


Draw Pseudo Hilbert Curve

Painting with Compute Shader

$
0
0

Finally tested compute shaders for drawing into render texture:

[LudumDare52] Theme: Harvest

$
0
0

Small bot programming game, sadly has only 2 commands to use in this initial version..

ldjam entry:
https://ldjam.com/events/ludum-dare/52/harvest-bot

Making Of video:
https://www.youtube.com/watch?v=1B7P3mS4_i4

Ideas for future (if want to extend this later..)
– More features (sensor to direction, shoot, enemies, destroyable objects )
– Play against other bots in same scene (import other bot brains online)
– Different scenes
– View brain toggle during play (can see what step is executing)
– ..

Previous jam entry:
https://ldjam.com/events/ludum-dare/50/wobbly-plankster

Using OpenAI API with WebRequest from Unity

Fake 3D Parallax Effect using Shader & (Pre-generated) Depth Map

UnityHub 3.6.0: Remove Version Control & Cloud Dashboard columns

$
0
0

Before:

——————————–

After:

Steps:

  • Install 7zip https://www.7-zip.org/download.html
  • Install ASAR plugin for 7zip https://www.tc4shell.com/en/7zip/asar/
  • Close Hub completely (from notification bar also)
  • Run 7zip manager as Administrator
  • Browse into C:\Program Files\Unity Hub\resources\ folder
  • 7zip: Open app.asar file
  • 7zip: Browse into build/renderer/ folder
  • 7zip: Right click on “index.html” and select Edit
  • Notepad opens, press ctrl+F to search: </head>
  • Notepad: Press enter before the </head> tag (to add new lines there)
  • Notepad: Paste following CSS style inside head tag: https://gist.github.com/unitycoder/dc012222230c26dec631b4004063fc7f
  • Notepad: Press Save (ctrl+s)
  • Close notepad – ‘File index.html weas modified, do you want to update… Click OK to save
  • After save has finished, run Unity Hub normally (columns should be hidden now)

If you broke something, install hub again. (or better if you had taken backup copy of app.asar before modifying it)

You could modify other parts too, like remove excess padding from those rows..

video

Older post about customizing colors
https://unitycoder.com/blog/2022/03/02/customize-unityhub-colors/

You can also write python script to automatically modify template
https://gitlab.com/GuitarBro/hub-patcher

Updated hub patcher here: (to do the above modification automatically using python+npx)
https://github.com/unitycoder/UnityHubPatcher

Installing older hub version:
https://forum.unity.com/threads/a-new-hub-release-is-available-v3-6-0.1509407/page-2#post-9435404

Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub)

$
0
0

I just wanted to build Quest 3 XR demo apk quickly.. but ended up fighting with android sdk installations.

STEPS

TROUBLESHOOTING

sdkmanager.bat says: “.. been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0”
your java home is probably pointing into old folder, update windows env. variable for %JAVA_HOME% (and restart commandprompt to take effect)

info about versions:
49 = Java 5
50 = Java 6
51 = Java 7
52 = Java 8
53 = Java 9
54 = Java 10
55 = Java 11
56 = Java 12
57 = Java 13
58 = Java 14
59 = Java 15
60 = Java 16
61 = Java 17
62 = Java 18
63 = Java 19
64 = Java 20
65 = Java 21
https://stackoverflow.com/a/47457251/5452781

Video:


Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface

$
0
0

Required Packages

– Tested this on Unity 2023.2.3f1 (but works in other versions too)
– AI Navigation : https://docs.unity3d.com/Packages/com.unity.ai.navigation@2.0/manual/index.html
– 2D Tilemap Editor : https://docs.unity3d.com/Packages/com.unity.2d.tilemap@1.0/manual/index.html
– 2D Tilemap Extras : https://docs.unity3d.com/Packages/com.unity.2d.tilemap.extras@4.0/manual/index.html

Setup Tilemap with 3D Prefabs

– Add 2D Tilemap to Scene
– Set Grid Cell layout to XZY (so that its flat on ground)


– Create 3D Box in scene view, name it TileGrass, give it green color material, Make prefab from it (drag to Project window, some folder)
– Create 3D Box in scene view, name it TilePath, give it brown color material, Make prefab from it (drag to Project window, some folder)
– Project window: Create 2D/Tile palette/Rectangular
– Drag & Drop TileGrass and TilePath prefabs from Project window into Tile palette grid
– Select TileGrass in Tile Palette
– At Tile Palette window bottom left, select “GameObject Brush” from the dropdown (and click Toggle Brush Inspector button (top right bottom in Tile Palette window) *If they are not visible, resize tilepalette
– Assign Element 0: TileGrass prefab from Project window (do the same for TilePath)
– Now with TileGrass selected in Tile Palette window, you can paint into Scene Tilemap (select it first)
– Then toggle Paint mode in Tile Palette window top toolbar (the pencil brush button)
– You can erase painted tiles with left shift+left mouse button (or press I while mouse over some painted tile to Pick that tile as brush)

Adding NavMesh Pathfinding

– Select TileGrass prefab from Project window, add NavMesh Obstacle component to it

– Create new empty Gameobject in Scene, add NavMeshSurface component to it

– Test Baking, if road does not get over-layed with navmesh then open Window/AI/Navigation
– Make Agent radius 0.2 (so that it fits the road)

– Press Bake again in NavMeshSurface gameobject, blue area should appear over Path

Setup AI Agent

– Create new capsule gameobject in Scene (name it “Agent”)
– Place it at your tilemap path start position, can make it 0.5x smaller to fit better
– Add NavMeshAgent component to this gameobject
– Add this SampleAgent script to it https://gist.github.com/unitycoder/8e6e27faca3d40abf50c0842a51af558
– Create new empty gameobject in scene (name it “GoalGo”)
– Move it at the end of your Path
– Assign “GoalGo” gameobject into SampleAgent script in the gameobject
– Press Play
– Agent should move towards goal position, following the available path

References:
– NavMeshSurface: https://docs.unity3d.com/Packages/com.unity.ai.navigation@2.0/manual/NavMeshSurface.html
– Better 2D Navmesh (works with 2D objects instead of 3D objects) https://github.com/h8man/NavMeshPlus

Video:

Use TikTok-TTS in Unity (with WebRequest)

$
0
0

Was watching some weird physics based game developed at https://www.twitch.tv/clayman_dev and they used node.js+tiktok TTS to play funny text-to-speech sounds!

Then found this library, https://github.com/Steve0929/tiktok-tts
(took a while to get it working as node.js, due to sessionid+server mismatch, but posted solution here https://github.com/Steve0929/tiktok-tts/issues/17 )

Then “converted” it to Unity.. (*not much to convert, it is just a Webrequest (POST) and few header values.. problem is that if you post wrong data, it just says “404”, so you don’t know whats the issue..

Initially tried to get this working https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequestMultimedia.GetAudioClip.html but then checked original node.js sources, where it uses POST request, instead of GET.. so that was the main issue! (and setting cookie to getrequest was probably initially wrong,

Check repo source & instructions for getting tiktok sessionid+server:
https://github.com/unitycoder/tiktok-tts-unity

Sample audio:
https://soundcloud.com/user-689598301/tiktok-tts-sample

making of / struggling video:


*This is not their official API, so it could be closed anytime or the servers might change..

UnityHub: Make Hub application background Translucent

$
0
0

You can modify UnityHub to enable Translucent Background!
*Note Win10, you need to have transparent color enabled in settings: https://www.partitionwizard.com/partitionmagic/transparent-taskbar-win-10.html

Steps:
– Follow initial steps to unpack asar https://github.com/unitycoder/UnityHubModding
– edit app/build/renderer/index.html, add line: html, body, #app {background-color: rgba(0.7, 0.7, 0.7, 0.2) !important;}
– edit app/build/main/windowManager/baseWindow.js
// find line
const backgroundColor = this.getThemeBackgroundColor();
// replace with these 3 lines
let backgroundColor = this.getThemeBackgroundColor();
backgroundColor+= ’20’;
– Done!

Screenshot with windows desktop background showing through Hub:

Link to github:
https://github.com/unitycoder/UnityHubModding?tab=readme-ov-file#make-hub-background-translucent

Viewing all 58 articles
Browse latest View live