Resources access from outer class

Hello, newbie in Unity, I try to understand this program functionning.
I’m not used to work with scripts, and I hope it’s not the only way of programming in Unity, so I tried to work with my own classes like I used to do. But it seems to be difficult to acces Unity GameObjects and Unity program environment from user classes.
For exemple, I would like to generate Tiles at runtime from my own class called TileMaker. But how can I access Unity resources (here textures) form this class ?
I can’t find solution on the web.
Thank’s a lots.

I simply tried this :

Texture2D tx = (Texture2D)Resources.Load("Tiles/tile_road_1.1", typeof(Texture2D));

But tx returns null
The same code in a Unity Script return the Texture2D

Sorry, in fact it seems I have a problem with loading resources in general…

Well, I didn’t see that Unity resources MUST be in a folder called “Resources” :wink:
It seem’s to worl now.

1 Like