How to make a function to change material?
How to make function to change certain actor material ? I have actor class with main code like this:
And next one that tries to call function but it crush editor when I try like this.
Thank you for your response.
Your crash is probably being caused by a null pointer (nullptr) exception, or perhaps by the use of the ConstructorHelpers library outside of a class constructor.
In general, to avoid null pointer exceptions, you want to make sure your pointers are 'valid' before attempting to de-reference them with the
On the subject of loading project assets during runtime, I recommend you look at this article from the official docs: Referencing Assets. It shows some examples of the correct ways of doing so in C++.
Finally, have you considered setting references to your materials and meshes in the editor, using a blueprint derived from your ADresserBuilding class? In other words, if you make some UPROPERTY variables on your ADresserBuilding class for the materials and meshes you need, you'll be able to view and set these variables from within the editor. This way, you won't need to use hard asset references in C++, and it also allows you (or other artists) to change out these assets without having to recompile the code. Just a suggestion.
answered Jan 11 '19 at 08:27 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here