Closed Ziiyqol-coder closed 5 years ago
Open cmd, type "shutdown /r" and it'll add some crazy components into the gameobject 💦
less unturned related and more unity related, look up how to add components to gameobjects
You can't add component to item in inventory, but you can add component to item on ground.
public class Compoent : MonoBehaviour
{
}
ItemDrop item;
item.interactableItem.gameObject.AddComponent<Component>();
You can't add component to item in inventory, but you can add component to item on ground.
public class Compoent : MonoBehaviour { }
ItemDrop item; item.interactableItem.gameObject.AddComponent<Component>();
Is it possible? As far as I know, you can use only the classes existing in the game, but if you write your own, the game will not read the script.
Lol where did you hear that? 🤦♂️
You can't add component to item in inventory, but you can add component to item on ground.
public class Compoent : MonoBehaviour { }
ItemDrop item; item.interactableItem.gameObject.AddComponent<Component>();
Hmmmm, did you tried this ?
I apologize for misleading you. I examined the game code and found that the gameObject is not created on the server, only information about it is stored.
I don’t understand, are you talking about modding and adding a script to GameObject or writing a plugin on the server?
For performance reasons the server doesn't spawn any game objects for items, instead tracking a few details with the ItemData class. If you only need to associate some info while the item is on the ground you could use a dictionary using the instance ID as a key, but once the items are in players inventories there's unfortunately no per-instance storage. One workaround may be to use harmony to patch in an extra field, but that's outside my know-how.
(Also answered #1040)
How i can add a MonoBehaviour component to item whats in inventory/on ground?