-
Posts
7,936 -
Joined
-
Last visited
Community Answers
-
Rick's post in Instancing - Model shared between different prefabs? was marked as the answer
Yes, I believe if the same model is dragged into the editor, it in instanced which means they share certain aspects, material being one of them. In code I believe the Copy() method you can specify if you want the material to be shared or not, but as far as I recall in the editor the only way was to make a totally different model (not prefab but model). I did at one point suggest to give us a way to specify when dragging models into the scene if they should be instanced or copied without material sharing. The reason for the way it is would be it's less resources to share that information.
-
Rick's post in Can You Move A Collision Mesh With A Model Without Code? was marked as the answer
CSG shape as a child in the editor?
-
Rick's post in Flowgraph and functions arguments was marked as the answer
Notice how the function has --in at the end. That tell the editor it can be called. When --in functions exist with parameters you need a function that has --args and returns a value (I believe is the name) and then that'll show up and you can drag that function to the dot that should show up in the flowgraph on the line of the ReceiveHealth() function. So dots show up on that line and they act as argument placeholders (1 for each argument). When you drag a --args function to that line, that function will be called and the returning value will act as the argument value.
-
Rick's post in Variable Local Lua was marked as the answer
It's local to the entire script, which means the entire script can see it.
-
Rick's post in Variables in other scripts? was marked as the answer
I assume you mean entity scripts (scripts attached to entities). There would be a couple ways to do it.
You could link the entity via a script properties. In the script you want to access the other script make a Script variable like say Script.otherEntity = nil --entity. In the properties you'll have a section for this that you can drag and drop another entity in your scene onto. Now you can access it's scripts variables via self.otherEntity.script.theVariableIWant. You could loop over all entities in the world and find the one(s) you want and then access it via entity.script.theVariableIWant. So the idea is once you get a hold of the entity itself it has a .script property which gives you access to it's script variables and functions and there are a couple ways to access an entity from another entity. If you have just a few design time entities #1 works well. If you have a lot or run-time entities then method 2 works well I think.