当前位置: 首页>>代码示例>>C#>>正文


C# UnityEngine.Texture类代码示例

本文整理汇总了C#中UnityEngine.Texture的典型用法代码示例。如果您正苦于以下问题:C# Texture类的具体用法?C# Texture怎么用?C# Texture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Texture类属于UnityEngine命名空间,在下文中一共展示了Texture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Awake

 private void Awake()
 {
     myRenderer = GetComponentInChildren<Renderer> ();
     originalTexture = myRenderer.material.mainTexture;
     SetStartPosition (startPosition);
     InitMapObjectType();
 }
开发者ID:juliancruz87,项目名称:madbricks,代码行数:7,代码来源:MapObject.cs

示例2: OnEnable

        void OnEnable()
        {
            touchManager = target as TouchManager;

            var path = AssetDatabase.GetAssetPath( MonoScript.FromScriptableObject( this ) );
            headerTexture = AssetDatabase.LoadAssetAtPath<Texture>( Path.GetDirectoryName( path ) + "/Images/TouchManagerHeader.png" );
        }
开发者ID:HuffyTomson,项目名称:EndlessSaladAndBreadsticks,代码行数:7,代码来源:TouchManagerEditor.cs

示例3: AspectSelectionGrid

 public static int AspectSelectionGrid(int selected, Texture[] textures, int approxSize, GUIStyle style, string emptyString, out bool doubleClick)
 {
     GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinHeight(10f) };
     GUILayout.BeginVertical("box", options);
     int num = 0;
     doubleClick = false;
     if (textures.Length != 0)
     {
         float num2 = (EditorGUIUtility.currentViewWidth - 20f) / ((float) approxSize);
         int num3 = (int) Mathf.Ceil(((float) textures.Length) / num2);
         Rect aspectRect = GUILayoutUtility.GetAspectRect(num2 / ((float) num3));
         Event current = Event.current;
         if (((current.type == EventType.MouseDown) && (current.clickCount == 2)) && aspectRect.Contains(current.mousePosition))
         {
             doubleClick = true;
             current.Use();
         }
         num = GUI.SelectionGrid(aspectRect, selected, textures, Mathf.RoundToInt(EditorGUIUtility.currentViewWidth - 20f) / approxSize, style);
     }
     else
     {
         GUILayout.Label(emptyString, new GUILayoutOption[0]);
     }
     GUILayout.EndVertical();
     return num;
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:26,代码来源:TerrainInspector.cs

示例4: ComponentTypeDesc

 public ComponentTypeDesc(string name, Type type, Texture icon, string tooltip)
 {
     Name = name;
     Type = type;
     Icon = icon;
     Tooltip = tooltip;
 }
开发者ID:groov0v,项目名称:edriven-gui,代码行数:7,代码来源:ComponentTypeDesc.cs

示例5: CreateFromTexture

 public static tk2dSpriteCollectionData CreateFromTexture(Texture texture, tk2dSpriteCollectionSize size, Rect region, Vector2 anchor)
 {
     string[] names = new string[] { "Unnamed" };
     Rect[] regions = new Rect[] { region };
     Vector2[] anchors = new Vector2[] { anchor };
     return CreateFromTexture(texture, size, names, regions, anchors);
 }
开发者ID:Lessica,项目名称:Something-of-SHIPWAR-GAMES,代码行数:7,代码来源:SpriteCollectionGenerator.cs

示例6: LoadResources

        static public void LoadResources()
        {
            UnityPrimitiveCubeThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Cube.png");
            UnityPrimitiveSphereThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Sphere.png");
            UnityPrimitiveCylinderThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Cylinder.png");
            UnityPrimitiveCapsuleThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Capsule.png");
            UnityPrimitivePlaneThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Plane.png");
            UnityPrimitiveQuadThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Quad.png");

            UnityPrimitivePointlightThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Pointlight.png");
            UnityPrimitiveArealightThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Arealight.png");
            UnityPrimitiveSunlightThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Sunlight.png");
            UnityPrimitiveSpotlightThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Spotlight.png");
            UnityPrimitiveReflectionprobeThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Reflectionprobe.png");
            UnityPrimitiveLightprobegroupThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Lightprobegroup.png");

            UnityPrimitiveParticlesystemThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Particlesystem.png");
            UnityPrimitiveAudioemitterThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Audioemitter.png");
            UnityPrimitiveAudioreverbThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Audioreverb.png");

            UnityPrimitiveCameraThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Camera.png");
            UnityPrimitiveCameraviewportThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Cameraviewport.png");
            UnityPrimitiveTreeThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Tree.png");
            UnityPrimitiveLandscapeThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Landscape.png");
            UnityPrimitiveSpriteThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Sprite.png");
            UnityPrimitiveNullobjectThumb = (Texture)AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlus_Icon_Nullobject.png");


            ButtonSize.x = UnityPrimitiveCubeThumb.width;
            ButtonSize.y = UnityPrimitiveCubeThumb.height;
            IconsSkin = AssetDatabase.LoadMainAssetAtPath(EditorPlus.PlusPath +EditorPlus.SelectedSkinFolder + "UnityPlusSkinIcons.guiskin") as GUISkin;

            if(window != null)
                window.Repaint();
        }
开发者ID:PramgaOnce,项目名称:GlobalGameJam2016,代码行数:35,代码来源:EditorPlusPrimitives.cs

示例7: Reset

		public override void Reset()
		{
			gameObject = null;
			materialIndex = 0;
			namedTexture = "_MainTex";
			texture = null;
		}
开发者ID:AlexanderUrbano,项目名称:shapewars,代码行数:7,代码来源:SetMaterialTexture.cs

示例8: Reset

		public override void Reset() {
			
			base.Reset();
			
			this.tempTexture = null;
			
		}
开发者ID:Cyberbanan,项目名称:Unity3d.UI.Windows,代码行数:7,代码来源:TextureResourceItem.cs

示例9: DrawBackground

        public static void DrawBackground(Rect position, Texture image, float scale = 0.15f)
        {
            float texWidth = image.width * scale;

            GUI.BeginGroup (position);
            // Top Left Region
            GUI.DrawTextureWithTexCoords (new Rect (0, 0, texWidth, texWidth), image, new Rect (0, 1 - scale, scale, scale));
            // Top Center Region
            GUI.DrawTextureWithTexCoords (new Rect (texWidth, 0, position.width - texWidth * 2, texWidth), image, new Rect (1 - scale, 1 - scale, 0, scale));
            // Top Right Region
            GUI.DrawTextureWithTexCoords (new Rect (position.width - texWidth, 0, texWidth, texWidth), image, new Rect (1 - scale, 1 - scale, scale, scale));
            // Middle Left Region
            GUI.DrawTextureWithTexCoords (new Rect (0, texWidth, texWidth, position.height - texWidth * 2), image, new Rect (0, 1 - scale, scale, 0));
            // Middle Center Region
            GUI.DrawTextureWithTexCoords (new Rect (texWidth, texWidth, position.width - texWidth * 2, position.height - texWidth * 2), image, new Rect (0.5f, 0.5f, 0, 0));
            // Middle Right Region
            GUI.DrawTextureWithTexCoords (new Rect (position.width - texWidth, texWidth, texWidth, position.height - texWidth * 2), image, new Rect (1 - scale, 1 - scale, scale, 0));
            // Bottom Left Region
            GUI.DrawTextureWithTexCoords (new Rect (0, position.height - texWidth, texWidth, texWidth), image, new Rect (0, 0, scale, scale));
            // Bottom Center Region
            GUI.DrawTextureWithTexCoords (new Rect (texWidth, position.height - texWidth, position.width - texWidth * 2, texWidth), image, new Rect (1 - scale, 0, 0, scale));
            // Bottom Right Region
            GUI.DrawTextureWithTexCoords (new Rect (position.width - texWidth, position.height - texWidth, texWidth, texWidth), image, new Rect (1 - scale, 0, scale, scale));
            GUI.EndGroup ();
        }
开发者ID:hunvil,项目名称:ConvergeGame_Client,代码行数:25,代码来源:Functions.cs

示例10: EventHandlerDesc

 public EventHandlerDesc(string name, Type type, Texture icon, string tooltip)
 {
     Name = name;
     Type = type;
     Icon = icon;
     Tooltip = tooltip;
 }
开发者ID:groov0v,项目名称:edriven-gui,代码行数:7,代码来源:EventDesc.cs

示例11: GUIContent

 public GUIContent(Texture image, string tooltip)
 {
     this.m_Text = string.Empty;
     this.m_Tooltip = string.Empty;
     this.m_Image = image;
     this.m_Tooltip = tooltip;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:7,代码来源:GUIContent.cs

示例12: DescriptorAttribute

 public DescriptorAttribute(string name, string description, Texture icon, Color color)
 {
     this.name = name;
     this.comment = description;
     this.icon = icon;
     this.color = color;
 }
开发者ID:Headgate2,项目名称:-mobile-games-pipeline,代码行数:7,代码来源:Descriptor.cs

示例13: CreateFromTexture

        public static tk2dSpriteCollectionData CreateFromTexture(Texture texture, SpriteCollectionSize size, string[] names, Rect[] regions, Vector2[] anchors)
        {
            GameObject go = new GameObject("SpriteCollection");
            tk2dSpriteCollectionData sc = go.AddComponent<tk2dSpriteCollectionData>();
            sc.Transient = true;
            sc.version = tk2dSpriteCollectionData.CURRENT_VERSION;

            sc.invOrthoSize = 1.0f / size.orthoSize;
            sc.halfTargetHeight = size.targetHeight * 0.5f;
            sc.premultipliedAlpha = false;

            sc.material = new Material(Shader.Find("tk2d/BlendVertexColor"));
            sc.material.mainTexture = texture;
            sc.materials = new Material[1] { sc.material };
            sc.textures = new Texture[1] { texture };

            float scale = 2.0f * size.orthoSize / size.targetHeight;

            // Generate geometry
            sc.spriteDefinitions = new tk2dSpriteDefinition[regions.Length];
            for (int i = 0; i < regions.Length; ++i)
            {
                sc.spriteDefinitions[i] = CreateDefinitionForRegionInTexture(texture, scale, regions[i], anchors[i]);
                sc.spriteDefinitions[i].name = names[i];
            }

            foreach (var def in sc.spriteDefinitions)
                def.material = sc.material;

            return sc;
        }
开发者ID:hyf042,项目名称:BakeryGirl-chess,代码行数:31,代码来源:tk2dRuntimeSpriteCollection.cs

示例14: registerItem

        public static void registerItem(String id, Texture invTexture, GameObject model)
        {
            if (items.ContainsKey(id))
                throw new Exception("Cannot have two items with the same id (" + id + ")");

            items[id] = new ItemData(invTexture, model);
        }
开发者ID:MarjieVolk,项目名称:BeautyAndTheBeast,代码行数:7,代码来源:Item.cs

示例15: PipeTextures

        protected void PipeTextures()
        {
            RefreshTextureScript rts = this.GetComponent<RefreshTextureScript>();
            if (rts != null) {
            this.source = rts.toReplace;

            } else {
            //grab original base texture. this is source.
            this.source = this.renderer.material.GetTexture("_MainTex");
            }
            if ((this.source as RenderTexture) != null) {
            RenderTexture s = this.source as RenderTexture;
            //create new destination texture.
            this.destination = new RenderTexture(s.width,s.height,s.depth);

            } else {
            this.destination = new RenderTexture(source.width,source.height,24);
            }

            //assign destination texture to existing shader.
            if (rts != null) {
            rts.toReplace = this.destination;
            } else {
            this.renderer.material.SetTexture("_MainTex",this.destination);
            }
        }
开发者ID:rlawther,项目名称:AmnesiaMuseumUnity,代码行数:26,代码来源:icMotionBlur.cs


注:本文中的UnityEngine.Texture类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。