change texture on link object

hi, i have link an object to my game and duplicate it with alt+d, now i wont to keep them all linked but i also want to give them a diffrent textures (i want to make a sign and linked it to my game, and i want to make a diffrent texture on each sign).
i search for this problem on google and find a way to do it by change the metrial from data to object, it work good but when i start the game its go back to the old texture, i find some post that have the same problem but he didnt get an answer, the post from 2013 so maybe someone have any new idea how to fix it?
here is the post and he expline the problem better then me:)

You need to replace the complete mesh via replaceMesh() (Python).

but i only want to change the textue, not the mesh. insted of replace mesh it will be simple and faster to just make all the mesh with the right texture and link them…
or i miss something?

The BGE API does not offer to exchange the texture.

You can do load a different texture with the video texture module. It is not simple but it is possible.


import bge
from bge import logic
from bge import events


import VideoTexture


cont = logic.getCurrentController()
obj = cont.owner


k = logic.keyboard


a = k.events[events.AKEY]
s = k.events[events.SKEY]


if not 'texture' in obj:
    mat = VideoTexture.materialID(obj, 'MAFace')
    obj['texture'] = VideoTexture.Texture(obj, mat)
    obj['file'] = 'Sad.png'
    obj['changed'] = 0
else:
    if obj['changed']:
        path = logic.expandPath('//'+obj['file'])
        obj['texture'].source = VideoTexture.ImageFFmpeg(path)
        obj['changed'] = 0
        obj['texture'].refresh(True)


if a == 1:
    obj['file'] = 'Happy.png'
    obj['changed'] = 1
elif s == 1:
    obj['file'] = "Sad.png"
    obj['changed'] = 1

Create two images (happy.png/sad.png) and put them in the same directory as .blend file.
Link this code to always sensor and set it to usePosPulse mode.
“A/S” changes texture.

But first unwrap your mesh with one of the textures and appliy material with name “FACE”

P.S.this will still change the texture of all linked objects. You will need to change the material in order to get different textures on different objects.

thx, but it not simple and good enough.
i try to do taht with a big texture on my model that have all the textures that i need and i can controll the texture position with bone and uv warp modifier, and then i can link the model and the bone to the main file and proxy only the bone and then i can set the texture how i want.
But…
if i duplicate the object (the group) the bone controll all the objectes,
example:
i made a sign that have 1 big texture that contain 5 diffrent sign and with the bone i can set the position of the texture and i get diffrent sign on one object, i group all of this and name it “sign1”,
now i move to the main project file and link the “sign1” group, i make the bone proxy and now i can change the texture on the main file.
but if i want to bring more refrence of “sign1” its all controll by one bone and not noly by his own bone.

i hope u understand…
how i can have that all group will be controll only by the bone of his own group?

You can modify the UV-coordinates by manipulating the mesh_proxy

use node material and set the uv using object color
(allowing unique materials per object for uv animations)

i think i cant, the texture of the proxy is still lock cuse it link to the source file.
anywat, i upload here an example of the files, one is the source (linkFromHere) and i have there 3 object in one group, the sign that i want to change his texture, a mini map of the big texture and an armutre with bone that control the big texture.
in the source file its work good, i can move the bone in pose mode and the texture change as well,
now i have another file, LinkToHere, in this file i link the group from the other file, i make the armuture proxy and now i can change the texture, if i make the sign proxy to, the texture of the proxy not change, only rhe texture of the group sign u can move only the egroup and see that.
and if i link the sign more then one, its all change toghter.
i need to have a lot of sign link from the source file (that i will be able to change the mesh of the sign from the source file), and i need to have the option to change every sign with diffrent texture\metirial or what u can think about…
i also try to make a python that move only the uv and then i could make a button for it, but i couldent make it work.
so if somebody can help me i will be very happy…
here is the file:
https://drive.google.com/drive/folders/1RN6IFUo-HtcE6Ze4gWT8jF0D4h9NgkcC?usp=sharing

moving the uv on a single instance will move the vertex of all meshes using that mesh

an expensive alternative is using libnew to dulicate the mesh on creation of the object and replace the mesh w/the duplicate.

using object color to set uv cords in nodes is really easy and cheap and works with mulitple instances, using unique object color/sprite animation frame per instance,

how to do that? i try a little but i cant find any tut…

object data node(color) -split rgb - R - Mix node amount -(texture1/texture2)-color[material] - (output)

(for a simple 2 texture system using R channel)

you can mix after the material for shadeless etc.