Resources Protocol

From PowerUI
Jump to: navigation, search

resources:// is a great way to refer to any file within a Resources folder in your project. It's the default protocol too. It works with everything that accepts a URI - from XMLHttpRequest through to CSS background-image. You can have multiple folders called Resources in your project, and any sub-folders do "just work". For example:

Resources/MyImages/logo.png

<img src='resources://MyImages/logo.png'>

File extensions like .css

Unity doesn't recognise 'css' as a textual file when in the project. You'll need to either name it 'myFile.css.bytes' for your 'myFile.css' links to work, or name it something that Unity does recognise as a text file like .txt or .html.