Conseils, services, ingénierie en informatique. Mise en place de solutions technologiques, et support, pour les entreprises.

Note utilisateur: 5 / 5

Etoiles activesEtoiles activesEtoiles activesEtoiles activesEtoiles actives
 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 and unity : hello world

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 unity Hello World

Dot net 8 Csharp testing with Godot : hello world

 

I tested C# with godot engine in this article:

https://www.consultingit.fr/fr/csharp-testing-on-windows-11-version-23606-with-dot-net-8-0-100-and-godot-engine-4-2-1-godot-engine

, now I want to test a C# Hello World with Unity engine.

Why testing C# in Unity engine? To test if this specific Windows Operating system version is able to run a 3rd party app, and because and it's fun to be able to create games with the C# language :-)

 

And many thanks to Mina Pêcheux for the inspiration and greats articles about games engines Godot and Unity: 

https://minapecheux.com/blog/2022/11/29_so-godot-or-unity-6fef621a9d06

 

 

 

About the author...

ident021 180 facebook linkedin insider mcp learn metadatas sans cravate 128x128 autocolors 18052006 191123 mcse microsoft logomcsa microsoft logomcdba logo

since 2001, Insider since 2014.

 

Thanks to Microsoft EMEA GBS to let me participate in the year 2014 to the Insider project during my work. Then, This Windows test project, here in version 11, is based on the cycle of the insider Preview Builds, now in the Dev Channel: it is fun to test the new features. I can learn new features, validate them and share them with you :-)

 

This tutorial is made in a test environment, for pleasure and not to earn money. It is a non-profit project. It shows that the concept is possible, for a demontration, artistic, or educational purposes, school learning course. Don't test in a real environment in production.

 

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 and unity : os testing in the last article

 

The Windows 11 Operating System version 23606 was tested in the last article. Check article version 23606 here . Now that operating system is updated to 23619 and ready, i can test it with an application.

 

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 and unity : application installation

 

 

 

So I install Unity

I go to download the bundle here:

www.unity.com

https://unity.com/fr/download

https://public-cdn.cloud.unity3d.com/hub/prod/UnityHubSetup.exe

After i downloaded this 122 Mb package, i run it.

 

Authorize UAC:

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 installing unity UAC

Unity hub 3.7.0

Installation in:

C:\Program Files\Unity Hub

Install

Finish, run unity hub

i need to create an unity account with my email...Done!

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 and unity : install unity editor

 

Installation in:

C:\Program Files\Hub\editor

 

Required 1.59Gb

2022.3.17f1 install complete in C:\Program Files\Unity\Hub\Editor\2022.3.17f1\Editor\Unity.exe

Message : « No active licenses To create and open projects, you need an active license. »

Clic « Manage licenses »

Add licence

« Get a free personal license »

Accepter la license du 6/11/2023:

https://unity.com/fr/legal/editor-terms-of-service/software

Done

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 and unity : create a new project

 

Now I can create a new project

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 unity new project

 

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 and unity : 3D core template

 

I choose the template 3D core

Project name: Hello World

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 unity new project 3D Core

 

The Unity game engine user interface appears, tadaaa:

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 unity user interface

 

In the center there is the scene window, where we can see the visual of the game.It is the scene view.

On the left, the Hierarchy window where are listed the objects oft the scene.

On the top, the toolbar, with the play button and the pause button. Interesting there is a Unity Version Control, sort of “Github” to collaborate with mates.

On the right, the inspector, where we can edit the properties of the objects in the scene, like the light

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 and unity : Visual studio code as C# editor

 

In the last article:

https://www.consultingit.fr/fr/csharp-testing-on-windows-11-version-23606-with-dot-net-8-0-100-and-godot-engine-4-2-1-godot-engine

I installed Visual Studio Code. 

 

So, now, I want to use Visual Studio code to edit the C# scripts with Unity too.

Unity menu edit/preferences/Extenal tools

External script editor: Visual Studio Code 1.85.1.

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 unity editor visual studio code

 

So that we can code with visual studio code IDE.

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 and unity : creating the C# script

 

In the assets panel, i create a scripts folder (right clic/new/folder names scripts) It’s because experienced users do that and i saw that in lots of tutorials.

I create the C# script HellWorld.cs

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 unity hello world script

 

I double click on the file HellWorld.cs and Visual studio code opens.

« Do you want to install the recommended ‘Unity’ extension from Microsoft for this repository ? Yes. Install

« The Unity extension provides C# developers with a lightweight and streamlined Unity development experience on Visual Studio Code. It builds on top of the rich C# capabilities provided by the C# Dev Kit and C# extensions. This extension integrates natively with Visual Studio Code and includes multiple productivity features including:

A Unity debugger to debug your Unity editor and your Unity players.

Unity specific C# analyzers and refactorings.

Code coloration for Unity file formats (.asmdef, .shader, .uss, .uxml). »

 

Note:  The name of the class “public class HelloWorld : MonoBehaviour” must be the same that the name of the .cs script file HelloWorld.cs : it is a Unity rule, convention.

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 unity editor visual studio code hello world cs

 

In the HelloWorld script, i add the line Debug.Log(“Hello World from ConjsultingIT”);

public class HelloWorld : MonoBehaviour

{

    // Start is called before the first frame update

    void Start()

    {

        Debug.Log(“Hello World from ConsultingIT”);

    }

    // Update is called once per frame

    void Update()

    {

    }

}

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 and unity : attach C# script to game scene object

 

To execute this script, we need to attach it to an object in the scene.

In the Hierarchy Window, I create a “GameObject” object, by right clicking and selecting “create empty”

I select this “GameObject” object and in the Inspector panel, I select “add component” and “scripts”, and I add the HelloWorld.cs script.

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 unity GameObject script

 

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 and unity : startup scene

 

Now I must assign the Unity Scene to the list of scenes that will be compiled in our project.

Menu files/Build settings/

I click “add open scene” and the scene is added.

I close the “build settings” window.

Now I press the “play button” in the toolbar, and…

Hello world appears! Done!

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 unity Hello World

 

 

Csharp testing on Windows 11 version 23619 with Dot net 8.0.100 and unity : need help?

 

 

Need help to install unity on Windows 11 or write C# code? Send an email on loic @consultingit.fr