Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

How to change runtime material texture in Tiny Mode

Discussion in 'Project Tiny' started by MeTheOo, Sep 23, 2020.

  1. MeTheOo

    MeTheOo

    Joined:
    Dec 14, 2014
    Posts:
    23
    We would like to change 3d model texture when we touch the object, but cannot find any information about it.
     
  2. AbdulAlgharbi

    AbdulAlgharbi

    Unity Technologies

    Joined:
    Jul 27, 2018
    Posts:
    319
    You can change the texture for a mesh by
    - Get the mesh entity and Get the MeshRenderer component
    - From the MeshRenderer component get the material entity
    - From the Material entity get the Material component
    Change it as you want and apply the changes back
     
  3. AbdulAlgharbi

    AbdulAlgharbi

    Unity Technologies

    Joined:
    Jul 27, 2018
    Posts:
    319
    I have made a simple example to showcase changing material color (by pressing space bar)
    you can follow the same steps to change any material properties
     

    Attached Files:

    MeTheOo, YoungDeveloper and newguy123 like this.
  4. YoungDeveloper

    YoungDeveloper

    Joined:
    Jun 28, 2013
    Posts:
    65
    Hi example is very helpful, but it changes color only, could please showcase something regarding changing texture from serialized inspector, thanks a lot!
     
  5. Goularou

    Goularou

    Joined:
    Oct 19, 2018
    Posts:
    54
    I think that nobody, including Abdul, knows!
    This relates to an Entity itself included in the material Entity, where an Image2D component (but also others, such as Image2DLoadFromFileGuids or Web.Image2DHTML are present).
    This is pure madness, with no documentation nor examples whatsoever (look up for component stated above) and I am close to dropping tiny, ECS and even Unity!
    Really tired to be a sorcerer trying out charms with no spell book...
    Ridiculous
    EDIT: I leave the above as written, since Unity must hear about the incredible lack of documentation on Tiny project, totally discouraging.
    But DOTS and Unity are too good for me to drop all that / indeed, the recent short forum post of Joachim, CTO, ( https://forum.unity.com/threads/is-dots-being-abandoned.1183621/#post-7594702 ) reinsured me AND, in addition to being an awesome engine, the new CDN (so called Cloud Content Delivery)is really great (among other goodies, suprpessing the CORS hassle). Thanks.
     
    Last edited: Nov 6, 2021