I am trying to create a hotspot through script.
But it seems inactive.
This is my code:
`c
hotspot = GetComponent<Hotspot>();
proxyHotspot = (new GameObject("proxy_"+this.gameObject.name)).AddComponent<Hotspot>();
proxyHotspot.transform.position = new Vector3(1000, 1000, 1000);
proxyHotspot.transform.parent = this.transform.parent;
proxyHotspot.walkToMarker = hotspot.walkToMarker;
proxyHotspot.useButton = new Button();
proxyHotspot.useButton.faceAfter = true;
proxyHotspot.useButton.playerAction = PlayerAction.WalkToMarker;
proxyHotspot.useButton.interaction = interaction;
proxyHotspot.useButton.isDisabled = false;
proxyHotspot.provideUseInteraction = true;
proxyHotspot.provideLookInteraction = false;
proxyHotspot.provideUnhandledUseInteraction = false;`
When I select it in the editor during gameplay I receive: Hotspot 'proxy_Door' has been temporarily upgraded - please view its Inspector when the game ends and save the scene.
And after that the hotspot works as expected.
What am I doing wrong?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Oh sorry, I realized that I can just call
proxyHotspot.UpgradeSelf();
myself or that I have to addproxyHotspot.AddUseButtons(useButton)
useButton is deprecated in favour of the useButtons List. Try this instead: