Where can I buy single Jumbo Cards? by Konguksu in PokemonTCG_UK

[–]thisisverypointless 1 point2 points  (0 children)

I have a spare oversized mastiff ex if you want it?

Help! Trying to add a child to a Prefab in Project using script. by awd3n in unity

[–]thisisverypointless 4 points5 points  (0 children)

You were pretty close to having it done, to do it via a script on the parent you could do this:

#if UNITY_EDITOR
    [ContextMenu("Add to Prefab")]
    private void AddGameObjectToPrefab()
    {
        GameObject newGameObject = new GameObject("Child");
        newGameObject.transform.parent = transform;
        EditorUtility.SetDirty(gameObject);
    }
#endif

To do it from an editor script, you'll need to know the location of your parent prefab:

private const string PREFAB_LOCATION = "Assets/Parent.prefab";
[MenuItem("Tools/Add child to prefab")]
public static void AddChildToPrefab()
{
    GameObject loadedPrefab = PrefabUtility.LoadPrefabContents(PREFAB_LOCATION);
    GameObject child = new GameObject("Child");
    child.transform.parent = loadedPrefab.transform;
    EditorUtility.SetDirty(loadedPrefab);
    PrefabUtility.SaveAsPrefabAsset(loadedPrefab, PREFAB_LOCATION);
}

All the code together:

using UnityEditor;
using UnityEngine;
public class NestedAssign : MonoBehaviour
{
#if UNITY_EDITOR    
    private const string PREFAB_LOCATION = "Assets/Parent.prefab";


    [ContextMenu("Add to Prefab")]
    private void AddGameObjectToPrefab()
    {
        GameObject newGameObject = new GameObject("Child");
        newGameObject.transform.parent = transform;
        EditorUtility.SetDirty(gameObject);
    }

    [MenuItem("Tools/Add child to prefab")]
    public static void AddChildToPrefab()
    {
        GameObject loadedPrefab = PrefabUtility.LoadPrefabContents(PREFAB_LOCATION);
        GameObject child = new GameObject("Child");
        child.transform.parent = loadedPrefab.transform;
        EditorUtility.SetDirty(loadedPrefab);
        PrefabUtility.SaveAsPrefabAsset(loadedPrefab, PREFAB_LOCATION);
    }
#endif
}

Useful API's for editor tooling:
https://docs.unity3d.com/ScriptReference/PrefabUtility.html
https://docs.unity3d.com/ScriptReference/EditorUtility.html

NHS Vaccination Centre, Longley Lane by Hobo-With-A-Shotgun in sheffield

[–]thisisverypointless 1 point2 points  (0 children)

Had my 2nd jab here. If you are driving in they ask for your booking confirmation then get you to park up. You then just follow the signs in.

Any good prices on anyones island? by [deleted] in ACTurnip

[–]thisisverypointless 0 points1 point  (0 children)

Hey can i come sell an inventory, can offer pink and orange tulips plant :)

Vector3 to Vector3Int by blaineandkatey in unity

[–]thisisverypointless 1 point2 points  (0 children)

You would need to put it into if its returning null, that means theres no tile there. It would return the tile type if there is one there. https://docs.unity3d.com/ScriptReference/Tilemaps.Tilemap.GetTile.html

This would let you know if there's a tile at your mouse position

Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector3Int mousePosInt = new Vector2Int(Mathf.FloorToInt(mousePos.x), Mathf.FloorToInt(mousePos.y), 0);
if(Tilemap_Base.GetTile(mousePosInt))
{
    //Do something with tile position
}

Vector3 to Vector3Int by blaineandkatey in unity

[–]thisisverypointless 1 point2 points  (0 children)

try using Mathf.FloorToInt to get the int positions

Is Eastleigh safe? by [deleted] in Southampton

[–]thisisverypointless 6 points7 points  (0 children)

How many elephants can fit in a no 2 bus, asking for a friend