![]() right click in the scene hierarchy, and choose UI/Image. select it, and in the inspector, change the texture type to "Sprite"ģ. drag your PNG file into the assets folder.Ģ. If you are just wanting to draw a sprite on the screen (and have it move around), do the following:ġ. If you want to go against it (and no one's stopping you!) then learn a bit about how it all works firstĪre you wanting to load the sprite at runtime for some reason? Or are you just wanting to use a sprite? ![]() Your approach is immediately going against this intended workflow. As others have mentioned in some other replies to you, Unity uses a component-based architecture and has a very modular and editor-based approach to building scenes and adding logic. Sure, you can sort of work like this if you set up some systems and wrappers and it might work fine for you, but I'd recommend first learning and using Unity the way they encourage you to use so you know what you're dealing with. At the moment you seem to be approaching Unity at a very low-level, wanting to control framerates, load raw sprite data, have a single 'main' entry point, and done all in code. Check out something like Futile: įrom this and a few of your other questions, you should probably re-read the official Unity manual and scripting reference, go through the various tutorials, and get a good c# reference to help you out with the language. You should take a look at other code-based sprite systems if you want to see how they approach things. ![]() You can blit graphics onto the screen using the low-level graphics apis like Instead, to easily reference sprites from spritesheets just make Sprite variables in your behaviours and drop sprite references onto them. You'll have to do some plumbing with the 2d pipeline and spritesheet metadata that Unity creates for you during builds and the 2d materials if you want to mess with sprite references like that. If you're using Unity's native sprite system and not an external 2d library or framework then you don't really get clean code-based api access to the spritesheets.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |