Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Obi rope ends
#2
(25-09-2017, 11:01 PM)Parker Wrote: How can we get the rope end/start prefab and change Color or material during runtime.

When you attach a start and/or end prefab to the rope startprefab or the endprfab. We want to change material on the ends how can we get a handle or reference to the instantiated end

Hi!

You can use any of the GetComponent() family of GameObject functions to find the rope ends by component type. If your goal is just to change their color, a good approach would be to write a component that does this and add it to the prefab. This way the ends would change their own color themselves and you probably would not need to access them from the outside.

If you really need direct access to them, in ObiRope.cs you can find both as private variables around line 162:

Code:
private GameObject startPrefabInstance;
private GameObject endPrefabInstance;

You can just make them public to access them from the outside.
Reply


Messages In This Thread
Obi rope ends - by Parker - 25-09-2017, 11:01 PM
RE: Obi rope ends - by josemendez - 26-09-2017, 09:42 AM