![]() If (!_closeOpen & _frameCounter = _textures.Length - 1) Wait for the time defined at the delay parameter Here’s the code for the main play loop: IEnumerator PlayLoop(float delay) Each time the update routine is called, the texture is swapped for the object (which is only a wall consisting of two triangles). ![]() As I mentioned earlier, I used 13 PS files in a directory and then wrote the code to use those images. The first animation I tried involved 13 images from Descent I representing the exit door. My next task was to create an animated texture. Now you can save the PS file and use it, or you can save as PNG and use that in your textures in Unity. Photoshop shows invisible areas as a gray checker board area. The white areas will be rendered as white. The red-circled area is a section that I erased to become see-through. So zoom in to the editable image and start erasing the white areas: Erase areas to become see-through For this image, the outer border (which is white) should be invisible. You’ll should see two layers, like this:įinally, you can use the eraser to erase any area that will be see-through. This will cause the image to be located on another layer. Then select the image (CTRL-A), cut the image, and re-paste it. To create a see-through texture in Photoshop, you can open a graphics file (like png or jpg) into Photoshop. In the code you can change the texture load command to either directory to test for yourself: var textureList = Resources.LoadAll("Textures/door13png", typeof(Texture)) The PNG files can be found in the door13png directory. I also tested the animation with PNG files. The door13 directory contains the PS files. If you go to my GitHub account and download the sample code from this repository: UnityTextureUV, you’ll see two directories inside the Assets/Resources/Textures sub-diretory. According to some articles on transparent textures, the Photoshop PS file can be used directly. Then I created a transparent texture using Photoshop. I changed my wall create code to use Transparent/Diffuse instead of the Diffuse material: _doorMaterial = new Material(Shader.Find("Transparent/Diffuse")) The first trick is to use a material that is transparent. There are two tricks to using a transparent texture in Unity. If you don’t find this door and escape, your ship gets destroyed in the mine when the countdown expires. Exiting through this door will allow you to escape and continue on with the next level. If you’ve ever played Descent I in the past, you’ll instantly recognize this door as the one that opens after blowing up the reactor. My purpose is to recreate some pieces of the game to see if I can do it in Unity. In case you haven’t been following my blog posts, I’ve been reverse engineering the original Descent I game.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |