unity3d

When should I use public, private, or [SerializeField]? Unity C#

二次信任 提交于 2021-01-20 13:53:57
问题 When should I use public, private, or [SerializeField]? which is the most practical? 回答1: First, you need to make sure you understand the difference between public and private variables. Here's the official documentation for different access modifiers. I strongly recommend you read through it, but a simple version would be that public variables can be referenced by other classes, while private variables cannot. Imagine if you have a Player class with a Health field. Let's assume that by your

When should I use public, private, or [SerializeField]? Unity C#

陌路散爱 提交于 2021-01-20 13:49:24
问题 When should I use public, private, or [SerializeField]? which is the most practical? 回答1: First, you need to make sure you understand the difference between public and private variables. Here's the official documentation for different access modifiers. I strongly recommend you read through it, but a simple version would be that public variables can be referenced by other classes, while private variables cannot. Imagine if you have a Player class with a Health field. Let's assume that by your

When should I use public, private, or [SerializeField]? Unity C#

删除回忆录丶 提交于 2021-01-20 13:46:24
问题 When should I use public, private, or [SerializeField]? which is the most practical? 回答1: First, you need to make sure you understand the difference between public and private variables. Here's the official documentation for different access modifiers. I strongly recommend you read through it, but a simple version would be that public variables can be referenced by other classes, while private variables cannot. Imagine if you have a Player class with a Health field. Let's assume that by your

When should I use public, private, or [SerializeField]? Unity C#

拟墨画扇 提交于 2021-01-20 13:45:11
问题 When should I use public, private, or [SerializeField]? which is the most practical? 回答1: First, you need to make sure you understand the difference between public and private variables. Here's the official documentation for different access modifiers. I strongly recommend you read through it, but a simple version would be that public variables can be referenced by other classes, while private variables cannot. Imagine if you have a Player class with a Health field. Let's assume that by your

When i use Invoke to a method i want to use i can't call it anymore?

不羁岁月 提交于 2021-01-20 09:12:09
问题 I started to learn coding myself by watching videos, reading web articles etc. and i thought that learning by doing would suit better for me so i started to make a game with Unity through Brackeys tutorial videos. using UnityEngine.SceneManagement; using UnityEngine; public class gameManager : MonoBehaviour { bool hasGameEnded = false; public float restartDelay = 1f; public void endGame() { if (hasGameEnded == false) { hasGameEnded = true; Invoke("Restart", 2f); } void Restart() {

unity GameObject.IsStatic的地雷

橙三吉。 提交于 2021-01-19 12:33:14
Unity的GameObject的static的属性是个特殊的存在,当为了性能勾选了static之后,运行时修改static属性是无效的,只有编辑的时候修改才是有效的。稍不注意,很多时候发现程序无法按照预期的结果运行,之后发现是static在运行时可以修改,但是无效,有点不明白Unity的这个设计。记录一下来避免发生类似的错误! 来源: oschina 链接: https://my.oschina.net/u/4409634/blog/4912337

[Unity工具]python导表工具01:读取excel

随声附和 提交于 2021-01-19 10:11:42
参考链接: https://blog.csdn.net/csdnnews/article/details/80878945 1.安装xlrd 如何安装从pypi上下载的程序包:https://jingyan.baidu.com/article/2c8c281dbb5f9d0008252ad7.html 结合cmd命令(进入某个目录):cd /d 目录 2.例子 test.xls(与执行代码同一目录) 1 import xlrd 2 3 file = " test.xls " 4 5 wb = xlrd.open_workbook(filename= file)#打开文件 6 print(wb.sheet_names())#获取所有表格名字 7 8 sheet1 = wb.sheet_by_index( 0 )#通过索引获取表格 9 print(sheet1.name,sheet1.nrows,sheet1.ncols) 10 11 rows = sheet1.row_values( 2 )#获取行内容 12 cols = sheet1.col_values( 1 )#获取列内容 13 print(rows) 14 print(cols) 15 16 print(sheet1.cell( 1 , 0 ).value)#获取表格里的内容,三种方式 17 print(sheet1

Go语言开发Excel导表工具(上)

て烟熏妆下的殇ゞ 提交于 2021-01-19 07:55:24
Go语言开发Excel导表工具(上) 前言 游戏开发中经常会遇到将Excel文件导出配置的需求,鉴于之前的导表工具面对数据比较多的表格(尤其是多语言表格)导致导表速度很慢,因此想自己实现一个导表工具。 调研 目前市面上编程语言比较多:Node、Python、C#、Go... 以前项目中有用C#的也有用Python的,对比发现Python导表还是挺快的。(后来发现其实使用不同的Excel读取插件,执行效率还各有不同)在前期调研中发现了网站 https://zhuanlan.zhihu.com/p/29847628 , 里面说是Go语言执行效率高,那就拿他试试吧。 Go语言 其实对于新语言,一开始就要了解它的语法,这里推荐一个网站 https://www.runoob.com/go/go-tutorial.html 里面都是一些简单的基础语法。 环境配置 目前选用JetBrains公司的GoLand编程工具 下载Go https://golang.google.cn/dl/ 下载GoLand https://www.jetbrains.com/go/ 安装好之后这里需要设置一下GOPATH, 如图的目录就是用来下载后面Go语言相关的package包。 开发 Go语言需要一个main函数,同一个文件夹下面的文件的package包名必须要一致,不然IDE会报错。具体的导表逻辑下篇会介绍。

Create a basic 2D platformer game in Unity

做~自己de王妃 提交于 2021-01-17 09:14:06
问题 I know very little Unity and would like to create a platform 2D game very simple, just using the basic shapes (squares, rectangles, circles, etc.). I searched the internet and I found a more complicated tutorial of what I need. For example, I saw this but its goal is more ambitious than mine (I have also seen other tutorials but I can't put in additional links). I would love to create something very easy as point to understand the program basics and then try to put something more complicated

standard pbr(二)

牧云@^-^@ 提交于 2021-01-13 07:34:42
下一步看像素着色器代码 half4 fragBase (VertexOutputForwardBase i) : SV_Target { return fragForwardBaseInternal(i); } half4 fragForwardBaseInternal (VertexOutputForwardBase i) { FRAGMENT_SETUP(s) #if UNITY_OPTIMIZE_TEXCUBELOD s.reflUVW = i.reflUVW; #endif UnityLight mainLight = MainLight (); half atten = SHADOW_ATTENUATION(i); half occlusion = Occlusion(i.tex.xy); UnityGI gi = FragmentGI (s, occlusion, i.ambientOrLightmapUV, atten, mainLight); half4 c = UNITY_BRDF_PBS (s.diffColor, s.specColor, s.oneMinusReflectivity, s.smoothness, s.normalWorld, - s.eyeVec, gi.light, gi.indirect); c.rgb += UNITY_BRDF_GI