public MaterialUnit(apOptMaterialInfo srcMatInfo)
            {
                _texture = null;
                _shader  = null;

                _isUseMaterialInfo = true;
                _materialInfo      = new apOptMaterialInfo();
                _materialInfo.MakeFromSrc(srcMatInfo);

                //_texture = _materialInfo._mainTex;
                //_shader = _materialInfo._shader;

                _material = new Material(_materialInfo._shader);
                _material.SetColor("_Color", new Color(0.5f, 0.5f, 0.5f, 1.0f));
                _material.SetTexture("_MainTex", _materialInfo._mainTex);

                //Material Info에 저장된 초기 설정값을 적용한다.
                _materialInfo.SetMaterialProperties(_material);



                if (_linkedPortraits == null)
                {
                    _linkedPortraits = new List <apPortrait>();
                }
                _linkedPortraits.Clear();

                //Debug.Log("신형 Shared Material 생성");
            }
示例#2
0
            public void MakeMaterial()
            {
                if (!IsUseMaterialInfo)
                {
                    //이전 버전으로 만드는 경우
                    _material = new Material(_shader);

                    _shaderID_MainTex = Shader.PropertyToID("_MainTex");
                    _shaderID_Color   = Shader.PropertyToID("_Color");

                    _material.SetTexture(_shaderID_MainTex, _texture);
                    _material.SetColor(_shaderID_Color, new Color(0.5f, 0.5f, 0.5f, 1.0f));
                }
                else
                {
                    //변경 19.6.15 : MaterialInfo를 이용하여 만드는 경우
                    apOptMaterialInfo matInfo = MaterialInfo;

                    _material = new Material(matInfo._shader);

                    _shaderID_MainTex = Shader.PropertyToID("_MainTex");
                    _shaderID_Color   = Shader.PropertyToID("_Color");

                    _material.SetTexture(_shaderID_MainTex, matInfo._mainTex);
                    _material.SetColor(_shaderID_Color, new Color(0.5f, 0.5f, 0.5f, 1.0f));

                    //속성대로 초기화
                    matInfo.SetMaterialProperties(_material);
                }

                //복원용 재질
                _material_Original = new Material(_material);


                ResetRequestProperties();
            }