hello, i want to change material properties like color of a mesh on an actor via c++ code . basically, if he gets hit or damaged or whatever, change color so its visible.
from what ive read i understand that in order to change any material properties i have to access the mesh of the actor. Now i tried it with blueprints, so i made the class and then added a static mesh as a shape in the editor. But i couldnt find a way to access the mesh at the actor in code …maybe i have overseen something ?.
anyway, i searched, and it seems that in order to do that i have to actually put a property of the mesh component in the class (if i read RAMAs post correct)
But how can i change the color now ? i am looking for something like GetMaterial()->setMaterialColor(), that changes the color of the material which is attached to the mesh.
Okay i tried around and i got it to work. First i declare it in the header file, and then i can use it in the constructor. it assigns a cube shape, and in the blueprinted class i can also edit it etc.
yes so what ? if you refer to me calling the same functions yes.
with the difference that your codesnippet was broken/incomplete,and since you didnt update your answer with a working version i posted the fixed code here so someone else has a working/complete piece of code.
It wasn’t broken or incomplete, the code you posted is “Exactly” the code I posted. I didn’t update my answer with a working version because that IS the working version. Anyway, I don’t want an argument, next time at least credit where you got an answer from.
you claim you dont want an argument, yet all you do is complain about not getting credit for posting some code snippet that you probably got half from other peoples tutorials . of course i got it from somewhere else. literally anything is, if i am using a framework and not exactly invent some new algorithm etc.
what you do is not really magic, as you are just calling functions that can be found in the reference, i looked up those functions and while i fixed your snippet i saved myself the typing. big deal. i dont even see whats the big deal, as i never claimed to have reinvented the whole engine or something, i simply posted working code that does exactly what i want, so other people can use it.
you said “being stupid” in your now deleted comment. if youre done :stop trolling with nonsense in this thread and deleting your old comments, and go back to posting broken codesnippets as “answers” XD
Hello, I am locking further comments on this for obvious reasons. Please refrain from discussions (and especially arguments) on AnswerHub posts.
Please also be aware that anything shared on the AnswerHub, Forums, Wiki, or GitHub become freely available for the use of the community and by Epic Games.