English       FAQ(e.g how to update old project to hot update project.)
简体中文     常见问题解答(例如如何把旧项目升级为可热更新项目)


v1.1 Update time 2023-02-27

C#Like is an Unity hot update script solution. You can hot update your C# script if you want to hotfix your project.
It support so much C# syntax, So you can easy to make your project into can be hot update.
You can debug code, you can interactive prefab data, you can using coroutine, you can inherit LikeBehaviour as inherit MonoBehaviour.
You don't need to register the type in not hot update script before use it in hot update script.

PLEASE NOTE that C#LikeFree can be downloaded from anywhere, is a FREE asset.
If you do not meet the conditions of Unity's personal license, you cannot use it for commercial purposes.
C#LikeFree is the lite version of the C#Like, it missing some features from full version.
For the user who owned the Unity's personal license, can use it easy to build a hot update project using C#.
For other user, can try to find out C#Like whether worth buying by on trial the C#LikeFree.
The file tree and usage guide of the C#LikeFree is same with C#Like, so the upgrade is very convenient.

Thanks to open source C#Light

As below are the samples which export to WebGL platform (Welcome export the C#LikeFree sample yourself to verify how to hot update script):
C#LikeFree Demo      C#Like Demo

Main Features

features C#Light C#LikeFree C#Like
object-orientedinterface inheritadds support partialadds support constructor(support this/base);destructor;class inherit;virtual function
math expression+ - * / % += -= *= /= %= > >= < <= != == && || ! ++ --(support i++ but not support ++i) ?: is asadds full support '++ --'adds bit operation '& | ~ ^ &= |= ^= << >> <<= >>='
keywordthisthis typeofthis base sizeof typeof unsafe $ @ #pragma #warning #error
Not support namespace.You must register the type in not hot update script before use it in hot update script.Support namespace,Don't need to register the type in not hot update script before use it in hot update script,and 'using alias/command/static'.adds 'using sentence'
exceptionthrowsame with C#Lightadds try-catch-finally
typevar void bool float double char string byte sbyte int uint short ushort long ulong nullsame with C#LightAdds support Nullable type and Nullable math expression and coalescing operator '?.' and '??'.
get/set AccessorOnly support automatic implement get/set accessorsame with C#LightAdds custom implement get set accessor
loopfor foreach continue break if-else return while do-whilesame with C#LightAdds switch-case-default
debugCan print error sentenceIn debug mode, you can use breakpoint and step-in to debug your code by VisualStudio. In hot update mode,you can get the stack information (include file name,class name, function name,which line) while got error.same with C#LikeFree, but greatly reduces the difference between debug mode and hot update mode because support more C# features
compile scriptIt may take several seconds or even more than ten seconds to compile at runtime, depending on the amount of your code, even if it has been Precompiled into token.All compilation processes are completed in the editor and saved as binary file. The loading time at runtime is almost negligible. Although the compilation time is basically the same (it even takes more time to build cached data), The loading time gives user an excellent experience.same with C#LikeFree
MonoBehaviournot supportYou can write your hot update script just same with in normal script. You can regard LikeBehaviour as MonoBehaviour in hot update script. adds support the coroutine.
multi-threadingnot supportsupport adds lock syntax
code annotation//same with C#Light// and /**/
macro and regionnot supportsame with C#Light#if #elif #else #endif #region #endregion
enumnot supportsame with C#Lightsupport
parameter modifiernot supportsame with C#Lightsupport 'ref out in params'
function overloadingnot supportsame with C#Lightsupport
default parametersnot supportsame with C#Lightsupport
CSVnot supportKissCSVsame with C#LikeFree
JSONnot supportKissJSONsame with C#LikeFree
Socket/WebSocketnot supportKissServerFramework is easy use in hot update script, corresponding C# server. This is a most simple and stupid IOCP server framework component include WebSocket/Socket/HTTP/MySQL. All your logic work in A single main thread, you don't need to worry about multi-threading problem. All the heavy work process by framework in background threads. Easy to use database even never hear about SQL. You won't use the SQL knowledge, just need define the struct of database table, and then can use that data and it will automatically synchronize data with client and database.same with C#LikeFree

C#Like Quick Guide

normal Unity codeC#Like hot update code
We define a simple class, inherit MonoBehaviour, call some Unity periodic functions which most commonly used Here are the same with the left side normal code, but using the hot update script.You can check it out the difference.

C#Like how to interactive data with Unity prefab

setting prefab in unity editorinteractiv in hot update script
As shown below, show how to get/set value and component which binding in prefab. BindHotUpdateClassFullName is the full name of the class with Namespace. As shown below, it's the binding hot update script.

C#Like no need register before use

You must register the type in not hot update script before use it in hot update script. Just direct use in hot update script,no need register

IL2CPP Stripping

Type StrippingGeneric type
IL2CPP will strip the engine code if they are not be use. Unfortunately, our hot update script happens to be the strip one. You must set 'Managed Stripping Level' to 'Low' or 'Medium' (can't set to 'High'). Check which *.dll that you'll be use in the future in the folder '{Unity install folder}\Editor\Data\Managed\UnityEngine\'. And then the modify 'Assets\C#Like\link.xml', make sure your type wont be stripping by IL2CPP. Because you can't JIT the generic type in IL2CPP,and must AOT. All the generic type must be used once in not hot update script before use in hot update script. We will automatic generate 'Assets\C#Like\Runtime\AheadOfTime\AheadOfTime.cs' while compile script. Theoretically all your generic types almost be generated when you finally release your product. Here is the file automatic generate in sample. Don't modify this file manually.

C#Like usage guide

File tree framework Usage guide for the whole framework(C#Lkie+KissServerFramework). If you just care about C#Lkie, you can just need to read step 6.

Convenient KissJson

Can use both in normal script and hot update script, you can easy convert between JSON string and class/struct(include hot update script and normal script), and the JSONData is supper easy to use.

C# feature of C#Like

class featureclass feature
Here are a interface IAnimal, and then abstract base class Animal inherit IAnimal, and then a normal class Mammals inherit Animal,finally a normal class Human inherit Mammals. This sample show the class feature.
Delegate and Lambda
We have 3 buttons('Test Delegate','Test Lambda','Test Bind') and a Text component in the interface.
Math Expression
loop syntax
custom get/set accessor
macro and region
parameter modifier
default parameters and function overloading

Contact me: csharplike@qq.com      粤ICP备2022042034号-1